SIGN UP

Messaging

Messaging allows exchanging instant messages between 2 or more participants. Messaging supports text and metadata. The conversation doesn't bind or depend on the audio/video calls, but there is a possibility to integrate messaging in audio/video calls. FEATURES:

  • 1. messaging is the separate part of WEB SDK but it uses [Client.login*] methods - in brief, if a user was already logged in he can use messaging functionality.
  • 2. messaging doesn't use backend JS scenario at all

See the minimum example to create messaging and to be able start a conversation:

Example

const voxSDK = VoxImplant.getInstance();
voxSDK.init({micRequired:false})
  .then(()=>voxSDK.connect())
  .then(()=>sdk.login('foo@bar.baz.voximplant.com', 'secretpass'))
  .then((e)=>{
    if(!e.result)
      throw e.message;
    console.log('[Voximplant] Ready, connected and logged in.');
    return VoxImplant.getMessenger();
  })
  .then((messaging)=>{
    messaging.on(VoxImplant.Messaging.MessengerEvents.CreateConversation,onCreateConversation);
    messaging.createConversation([]);
  })
  .catch(e=>console.error('[Voximplant] Oops! Something went wrong',e));

function onCreateConversation(e){
  console.log(`[Voximplant] New conversation here! ID:${e.conversation.uuid}`);
  e.conversation.sendMessage('Hello world!');
}

function onSendMessage(e){
  console.log(`[Voximplant] Message from ${e.message.sender}: ${e.message.text}`)
}