Messages

Get a message

Gets a single message from a conversation by its messageId.

Getting an individual message can be useful, for example if you want to check whether a user has read the message or not.

get/v1/{appId}/conversations/{conversationId}/messages/{messageId}

Request

Path parameters

appIdstring required
Example:abcd1234

A unique identifier of your TalkJS app. You can find your app ID on the Settings page of your dashboard.

conversationIdstring required
Example:0123456789abcdef

A unique identifier of a conversation.

messageIdstring required
Example:msg_123ABcdefghiJKlmNOpqRS

An automatically generated unique identifier of a message.

Response

Message fetched successfully.

idstring

An automatically generated unique identifier of this message.

type'UserMessage' | 'SystemMessage'

Whether this message is a message sent by a user, or a system message.

origin'web' | 'rest' | 'email' | 'import'

Indicates how this message was sent. Possible origin options are:

  • web browser or mobile WebView ("web")
  • REST API ("rest")
  • reply-to-email ("email")
  • REST API import operation ("import")
locationnumber[]

An array of two numbers that represent the longitude and latitude of a location, respectively.

location is only given if the message's type is a shared location.

textstring nullable

Text of a message body. text is only given if the message type is text.

customobject

A custom object with key-value pairs that you want to associate with a message. Both keys and values must be strings. You can access a custom property in for example API responses, webhook events, and themes.

conversationIdstring

Unique ID of the conversation this message is part of.

createdAtnumber nullable

The time at which the message was posted. For welcome messages the timestamp is always nil.

senderIdstring nullable

A unique identifier of the user who sent the message. For asystem messages the sender is always nil.

editedAtinteger

Timestamp when this message was edited, expressed as the number of milliseconds since the UNIX epoch (1970-1-1, 00:00:00 UTC).

referencedMessageIdstring nullable

Unique identifier of the message that this message is replying to. Referencing a message can be done via TalkJS UI.

Example response

{
  "id": "msg_123ABcdefghiJKlmNOpqRS",
  "type": "UserMessage",
  "origin": "web",
  "location": [
    51.44442681184582,
    5.4733118103642395
  ],
  "text": "Hi, how are you?",
  "custom": {
    "priority": "high"
  },
  "attachment": {
    "dimensions": {
      "height": 1125,
      "width": 516
    },
    "size": 51552,
    "url": "https://example.com/attachment.jpg"
  },
  "conversationId": "0123456789",
  "createdAt": 1697711905431,
  "senderId": "alice",
  "editedAt": 1629972494633,
  "referencedMessageId": "msg_012ABcdefghiJKlmNOpqRS",
  "readBy": [
    "zayneb"
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.