Messaging

If you need translation feature, see below.

circle-info

Message translation feature is provided through Google Cloud Translation. To use this feature, register an appropriate Google Cloud Service Account Key on our dashboard.

  • To enable message translation, provide the language code (ISO-639) in translationTargetLanguage parameter when logging in.

  • Supported languages (ISO-639) can be found herearrow-up-right.

  • 'translations' field in message object contains translated texts. Use language code as key to retrieve the text.

1. Get Messages

circle-info

Messages are sorted by most recent (default).

circle-info

Setting translationTargetLanguage parameter returns messages with translated text.

  • Use this to translate channel messages from the past.

  • For realtime message translation, see thisarrow-up-right.

const resp = await client.getMessages({
    channelId: 'my_channel',
    order: 'latest', // default: 'latest'. Use 'oldest' to order by oldest messages first
    limit: 10, // how many messages to fetch, default: 20, max: 50
});

if (resp.hasNext) {
    const lastMessageId = resp.messages[resp.messages.length - 1].id;
    
    const moreResp = await client.getMessages({
        channelId: 'my_channel',
        lastMessageId: lastMessageId,
        limit: 10,
    });
}

Response

2. View Messages With File Upload

View messages with file attachment.

circle-info

Messages are sorted by most recent (default).

circle-info

Setting translationTargetLanguage parameter returns messages with translated text.

  • Use this to translate channel messages from the past.

  • For realtime message translation, see thisarrow-up-right.

3. Send Message

circle-info

The following message types are supported: text, hidden, custom.

  • Push notification is not sent for hidden message type.

  • admin, admin_hidden message type can only be sent from TalkPlus dashboard or by calling REST API.

  • You can enter up to 10 key-value pairs in data field. The maximum size of key is 128 characters and the maximum size of value is 1024 characters. Both key and value must be strings.

  • Both message text and data cannot be empty when sending a message.

  • The maximum size of message text is 8192 characters.

  • The maximum file upload size is 15MB.

circle-info
  • Emojis supported by UTF-8 can be used in message text.

  • For custom emojis, required values can be put into message text then parsed directly.

4. View Message

View a single message.

5. Reply To Message

Reply to another message.

6. Mark As Read

You can mark a channel as read.

7. React To Message

You can add/remove reaction to a message.

circle-info
  • reaction must be alphanumeric and between 1 and 64 characters long.

  • Each message can have up to 10 reaction types.

  • Each reaction type can contain up to 100 user IDs.

8. Message Translation

circle-info

Message translation feature is provided through Google Cloud Translation. To use this feature, register an appropriate Google Cloud Service Account Key on our dashboard.

  • To enable message translation, provide the language codes (ISO-639) in targetLanguages parameter.

  • Supported languages (ISO-639) can be found herearrow-up-right.

9. Get Unread Message Count

You can find out how many channel members have not read a particular message.

10. Delete Message

You can delete your own message.

Last updated