Send and Receive Messages

Web Chat Core SDK

Send Message to User

const result = await client.messages.send({
  to: 'user id of contact',
  message: 'your message content'
});
Conversation ThreadsConversation Threads

Conversation Threads

Send Message to Group

const result = await client.messages.send({
  clientGroupId: 'groupId of the group',
  message: 'your message content'
});

Add attachment to messages

const file = new File(); // Dummy code, use file picker to get a file object
const fileResult = await client.files.upload(file);

const result = await client.messages.send({
  clientGroupId: 'groupId of the group',
  message: 'your message content',
  fileMeta: fileResult
});

Delete a message

const deleteMessageForAll = true;

const deleteOnlyForCurrentUser = false;

const result = await client.messages.delete('MESSAGE_KEY', shouldDeleteMessageForAll);

// or

const result = await client.messages.delete('MESSAGE_KEY', deleteOnlyForCurrentUser);
Blocked ConversationBlocked Conversation

Blocked Conversation

Delete conversation

const result = await client.messages.deleteConversation({
  userId: 'userId of contact',
});

const result = await client.messages.deleteConversation({
  groupId: 'groupId of group',
});

What’s Next
Did this page help you?