Messaging

Get Channel Messages

GET https://api.talkplus.io/v1.4/api/channels/:channelId/messages

Path Parameters

NameTypeDescription

channelId*

string

Query Parameters

NameTypeDescription

limit

string

number of messages to fetch. Default: 20, max: 50

lastMessageId

integer

Last message ID to query from (use for pagination)

order

string

Default Message order: latest latest: called without lastMessageId : most recent messages

called with lastMessageId : most recent messages before lastMessageId oldest: called without lastMessageId : oldest messages

called with lastMessageId: oldest messages after lastMessageId

Headers

NameTypeDescription

app-id*

string

App ID

api-key*

string

App API key

{
  "messages": [
    {
      "id": "sdf2l5s9j",
      "channelId": "channel123",
      "userId": "user456",
      "username": "user45",
      "profileImageUrl": "http://cdn.test.com/456.jpg",
      "type": "text",
      "text": "Hello world",
      "data": {
        "customField": "customData"
      },
      "fileUrl": "http://cdn.test.com/123.jpg",
      "mentions": [],
      "parentMessage": {},
      "reactions": {"happy": 1},
      "createdAt": 1583921400
    }
  ],
  "hasNext": false
}

Get Channel Message

GET https://api.talkplus.io/v1.4/api/channels/:channelId/message/:messageId

Path Parameters

NameTypeDescription

channelId*

string

messageId*

string

Headers

NameTypeDescription

app-id*

string

App ID

api-key*

string

App API key

{
    "id": "sdf2l5s9j",
    "channelId": "channel123",
    "userId": "user456",
    "username": "user45",
    "profileImageUrl": "http://cdn.test.com/456.jpg",
    "type": "text",
    "text": "Hello world",
    "data":    {
        "customField": "customData"
    },
    "parentMessage": {},
    "reactions": {
        "happy": 1
    },
    "fileUrl": "http://cdn.test.com/123.jpg",
    "mentions": [],
    "createdAt": 1583921400
}

Send Channel Message

POST https://api.talkplus.io/v1.4/api/channels/:channelId/messages/send

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

  • Push notification is not sent for hidden message type.

  • admin message type can only be sent from TalkPlus dashboard or by calling REST API (/v1/api/channels/{channelId}/messages/admin/send)

  • 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 allowed length of message text is 8192 characters.

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

    • Enter the language code (ISO-639) values in translationTargetLanguages parameter to translate the message text.

    • Supported languages (ISO-639) can be found here.

Path Parameters

NameTypeDescription

channelId*

string

Headers

NameTypeDescription

content-type

string

application/json

app-id*

string

App ID

api-key*

string

App API key

Request Body

NameTypeDescription

senderId*

string

message sender user ID

type*

string

message type

text

string

message text

data

object

key-value data

mentions

array

array of user IDs to mention

fileUrl

string

manually set file URL

translationTargetLanguages

array

languages to be translated (requires enabling the translation feature in the dashboard)

{
  "message": {
    "id": "sdf2l5s9j",
    "channelId": "channel123",
    "userId": "user456",
    "username": "user45",
    "profileImageUrl": "http://cdn.test.com/456.jpg",
    "type": "text",
    "text": "Hello world",
    "data": {
      "customField": "customData"
    },
    "fileUrl": "http://cdn.test.com/123.jpg",
    "mentions": [],
    "parentMessage": {},
    "reactions": {},
    "createdAt": 1583921400
  }
}

Send File Message

POST https://api.talkplus.io/v1.4/api/channels/:channelId/messages/send

  • In case of image file upload, Content-Type must be multipart/form-data.

  • Maximum upload size is 15MB.

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

  • Push notification is not sent for hidden message type.

  • admin message type can only be sent from TalkPlus dashboard or by calling REST API (/v1/api/channels/{channelId}/messages/admin/send)

  • 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 allowed length of message text is 8192 characters.

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

    • Enter the language code (ISO-639) values in translationTargetLanguages parameter to translate the message text.

    • Supported languages (ISO-639) can be found here.

Path Parameters

NameTypeDescription

channelId*

string

Headers

NameTypeDescription

content-type*

string

must be "multipart/form-data"

app-id*

string

App ID

api-key*

string

App API Key

Request Body

NameTypeDescription

senderId*

string

message sender user ID

type*

string

message type

text

string

message text

data

string

JSON formatted string

file*

string

file

file-content-type

string

file content-type. If not specified, TalkPlus server will try to determine the file type.

mentions

array

array of user IDs to mention

translationTargetLanguages

array

languages to be translated (requires enabling the translation feature in the dashboard)

{
  "message": {
    "id": "sdf2l5s9j",
    "channelId": "channel123",
    "userId": "user456",
    "username": "user45",
    "profileImageUrl": "http://cdn.test.com/456.jpg",
    "type": "text",
    "text": "Hello world",
    "data": {
      "customField": "customData"
    },
    "fileUrl": "http://cdn.test.com/123.jpg",
    "mentions": [],
    "parentMessage": {},
    "reactions": {},
    "createdAt": 1583921400
  }
}

Send Channel Admin Message

POST https://api.talkplus.io/v1.4/api/channels/:channelId/messages/admin/send

  • You can send an admin or admin_hidden type message.

  • admin_hidden type message does not increase unreadCount field for members in the channel.

  • Sender will be admin account associated with app. (you can edit admin user information in dashboard)

  • The maximum allowed length of message text is 8192 characters.

  • You can enter up to 5 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 allowed length of message text is 8192 characters.

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

    • Enter the language code (ISO-639) values in translationTargetLanguages parameter to translate the message text.

    • Supported languages (ISO-639) can be found here.

Path Parameters

NameTypeDescription

channelId*

string

Headers

NameTypeDescription

content-type

string

application/json

app-id*

string

App ID

api-key*

string

App API key

Request Body

NameTypeDescription

text

string

message text

data

object

key-value data

mentions

array

array of user IDs to mention

disablePushNotification

bool

set this to true to disable push notification for this message

type

string

admin or admin_hidden. default: admin

fileUrl

string

manually set file URL

translationTargetLanguages

array

languages to be translated (requires enabling the translation feature in the dashboard)

{
  "message": {
    "id": "sdf2l5s9j",
    "channelId": "channel123",
    "userId": "user456",
    "username": "user45",
    "profileImageUrl": "http://cdn.test.com/456.jpg",
    "type": "admin",
    "text": "Hello world",
    "data": {
      "customField": "customData"
    },
    "fileUrl": "http://cdn.test.com/123.jpg",
    "mentions": [],
    "parentMessage": {},
    "reactions": {},
    "createdAt": 1583921400
  }
}

Delete Channel Message

DELETE https://api.talkplus.io/v1.4/api/channels/:channelId/messages/:messageId

Path Parameters

NameTypeDescription

channelId*

string

messageId*

string

Headers

NameTypeDescription

content-type

string

application/json

app-id*

string

App ID

api-key*

string

App API key

Request Body

NameTypeDescription

text

string

message text

data

object

key-value data

{}

Last updated