SIGN UP

VIMessenger

Interface that may be used to control messaging functions.

Methods

addDelegate:

- (void)addDelegate:(id<VIMessengerDelegate>)delegate

Add delegate to handle messenger events.

Parameters

createConversation:moderators:title:distinct:enablePublicJoin:customData:uberConversation:

- (void)createConversation:(NSArray<VIConversationParticipant *> *)participants
                moderators:(NSArray<NSString *> *)moderators
                     title:(NSString *)title
                  distinct:(BOOL)distinct
          enablePublicJoin:(BOOL)enablePublicJoin
                customData:(NSDictionary *)customData
          uberConversation:(BOOL)uberConversation

Create new conversation.

Triggers the [VIMessengerDelegate messenger:didCreateConversation:] event for all messenger objects on all connected clients that are mentioned in the 'participants' array.

Parameters

  • participants:

    NSArray<VIConversationParticipant *> *

    Array of participants.

  • moderators:

    NSArray<NSString *> *

    Array of conversation moderators' names.

  • title:

    NSString *

    Conversation title.

  • distinct:

    BOOL

    Specify if conversation is distinct.

  • enablePublicJoin:

    BOOL

    If set to 'YES', anyone can join conversation by uuid.

  • customData:

    NSDictionary *

    Dictionary with custom data, up to 5kb.

  • uberConversation:

    BOOL

    Specify if the conversation is uber conversation.

editUserWithCustomData:privateCustomData:

- (void)editUserWithCustomData:(NSDictionary *)customData
             privateCustomData:(NSDictionary *)privateCustomData

Edit current user information.

Parameters

  • customData:

    NSDictionary *

    New custom data. If nil, previously set custom data will not be changed. If empty map, previously set custom data will be removed.

  • privateCustomData:

    NSDictionary *

    New private custom data. If nil, previously set private custom data will not be changed. If empty map, previously set private custom data will be removed.

getConversation:

- (void)getConversation:(NSString *)uuid

Get conversation by its UUID.

Requested conversation will be returned with [VIMessengerDelegate messenger:didGetConversation:] event.

Parameters

  • uuid:

    NSString *

    Conversation UUID.

getConversations:

- (void)getConversations:(NSArray<NSString *> *)uuids

Get multiple conversations by array of UUIDs. Maximum 30 conversations.

Note that calling this method will result in multiple [VIMessengerDelegate messenger:didGetConversation:] events.

Parameters

  • uuids:

    NSArray<NSString *> *

    Array of conversation UUIDs.

getMe

- (NSString *)getMe

Get the Voximplant user identifier, ex username@appname.accname, for the current user.

Returns

  • Return:

    NSString *

    Current user identifier.

getUser:

- (void)getUser:(NSString *)user

Get user information for the user specified by the Voximplant user identifier, ex username@appname.accname.

User will be returned with [VIMessengerDelegate messenger:didGetUser:] event.

Parameters

  • user:

    NSString *

    User identifier.

getUsers:

- (void)getUsers:(NSArray<NSString *> *)users

Get user information for the users specified by the array of the Voximplant user identifiers, ex username@appname.accname.

Note that calling this method will result in multiple [VIMessengerDelegate messenger:didGetUser:] events.

Parameters

  • users:

    NSArray<NSString *> *

    Array of user identifiers.

joinConversation:

- (void)joinConversation:(NSString *)uuid

Join current user to the conversation specified by the UUID.

Parameters

  • uuid:

    NSString *

    Conversation UUID.

leaveConversation:

- (void)leaveConversation:(NSString *)uuid

Leave current user from the conversation specified by the UUID.

Parameters

  • uuid:

    NSString *

    Conversation UUID.

managePushNotifications:

- (void)managePushNotifications:(NSArray<NSNumber *> *)notifications

Manage messenger push notification subscriptions.

Parameters

recreateConversation:title:distinct:enablePublicJoin:customData:uuid:sequence:moderators:lastUpdate:lastRead:createdAt:uberConversation:

- (VIConversation *)recreateConversation:(NSArray<VIConversationParticipant *> *)participants
                                   title:(NSString *)title
                                distinct:(BOOL)distinct
                        enablePublicJoin:(BOOL)enablePublicJoin
                              customData:(NSDictionary *)customData
                                    uuid:(NSString *)uuid
                                sequence:(NSNumber *)sequence
                              moderators:(NSArray<NSString *> *)moderators
                              lastUpdate:(NSNumber *)lastUpdate
                                lastRead:(NSNumber *)lastRead
                               createdAt:(NSNumber *)createdAt
                        uberConversation:(BOOL)uberConversation

Recreate conversation. Note that this method does not create conversation, but restore previously created conversation.

Parameters

  • participants:

    NSArray<VIConversationParticipant *> *

    Array of conversation participants.

  • title:

    NSString *

    Conversation title.

  • distinct:

    BOOL

    Specify if conversation is distinct.

  • enablePublicJoin:

    BOOL

    If set to 'YES', anyone can join conversation by uuid.

  • customData:

    NSDictionary *

    Conversation custom data.

  • uuid:

    NSString *

    Conversation UUID.

  • sequence:

    NSNumber *

    Sequence of last event.

  • moderators:

    NSArray<NSString *> *

    Array of conversation's moderators.

  • lastUpdate:

    NSNumber *

    UNIX timestamp that specifies the time of the last event in the conversation.

  • lastRead:

    NSNumber *

    Sequence of last event that was read by user.

  • createdAt:

    NSNumber *

    UNIX timestamp that specifies the time of the conversation creation.

  • uberConversation:

    BOOL

    Specify if the conversation is uber conversation.

Returns

recreateMessage:conversation:sender:text:payload:sequence:

- (VIMessage *)recreateMessage:(NSString *)uuid
                  conversation:(NSString *)conversationUUID
                        sender:(NSString *)sender
                          text:(NSString *)text
                       payload:(NSArray<VIPayload *> *)payload
                      sequence:(NSNumber *)sequence

Recreate a message. Note that this method does not create message, but restore previously created message.

Parameters

  • uuid:

    NSString *

    Universally unique identifier of message.

  • conversationUUID:

    NSString *

    UUID of the conversation this message belongs to.

  • sender:

    NSString *

    User id of the sender of this message.

  • text:

    NSString *

    Text of this message.

  • payload:

    NSArray<VIPayload *> *

    Array of Payload objects associated with the message.

  • sequence:

    NSNumber *

    Message sequence number.

Returns

removeConversation:

- (void)removeConversation:(NSString *)uuid

Remove the conversation specified by the UUID.

Parameters

  • uuid:

    NSString *

    UUID of the conversation to be removed.

removeDelegate:

- (void)removeDelegate:(id<VIMessengerDelegate>)delegate

Remove previously added delegate.

Parameters

setStatus:

- (void)setStatus:(BOOL)online

Set user presence status.

Triggers the [VIMessengerDelegate messenger:didSetStatus:] event for all messenger objects on all connected clients which are subscribed for notifications about this user. Including this one if conditions are met.

Parameters

  • online:

    BOOL

    YES if user is available for messaging, NO otherwise.

subscribe:

- (void)subscribe:(NSArray<NSString *> *)users

Subscribe for user information change and presence status change.

On change, the [VIMessengerDelegate messenger:didSetStatus:] event will be triggered.

Parameters

  • users:

    NSArray<NSString *> *

    Array of Voximplant user identifiers, ex username@appname.accname.

unsubscribe:

- (void)unsubscribe:(NSArray<NSString *> *)users

Unsubscribe for user information change and presence status change.

Parameters

  • users:

    NSArray<NSString *> *

    Array of Voximplant user identifiers, ex username@appname.accname.