You are viewing a section of Superface that will be deprecated in Q4 2023. Until then, you can continue to use it as you have before but we recommend that you migrate to our latest version soon. For more details visit superface.ai/docs/migrate.

Chat Messages

chat/messages@1.0.2
2 providers

Get chat messages

Retrieve paginated list of messages

Input
Destination
After Timestamp
Before Timestamp
Limit
Page
Result
Messages
Next Page
Rate Limit

1.Choose a provider

2.Use GetMessages with mock in your code

Below instructions are for our Node.js SDK. Use OneService for other languages.
npm i @superfaceai/one-sdk

Structure details

Input (object)

destination
Representation of a messaging destination. Can be ID or channel name, depending on the provider capability.
afterTimestamp
Retrieve only messages after the given UNIX timestamp (in milliseconds, e.g. 1095379198750)
beforeTimestamp
Retrieve only messages before the given UNIX timestamp (in milliseconds, e.g. 1095379198750)
limit
Maximum number of messages to retrieve in one page
page
Identification of page with paginated results (cursor)

Example

Result (object)

messages
List of retrieved messages
id
Unique identifier of the message
author
Author of retrieved message. Contains ID and username, depending on the provider capability.
id
username
createdAt
UNIX timestamp (in milliseconds, e.g. 1095379198750) when the message was created
url
URL address pointing to retrieved message.
hasThread
Boolean that represents whether message is parent to some thread
threadId
If the message was sent to a thread, identifies the parent thread by its Id.
text
Contents of the retrieved message
updatedAt
UNIX timestamp (in milliseconds, e.g. 1095379198750) when the message was last updated
reactions
List of reactions on retrieved message. Each reaction contains emoji string containing encoded emoji, number of reactions and list of users (IDs or usernames, depending on the provider capability)
emoji
count
users
attachments
List of attachments in retrieved message. Contains
id
Unique identifier of the attachment
createdAt
UNIX timestamp (in milliseconds, e.g. 1095379198750) when the attachment was created
fileName
Name of attached file
mediaType
MIME type of the attached file
url
Source url of the attachment
nextPage
Cursor to the next page for pagination forwards
rateLimit
Rate limit details.
bucket
Different parts of API may have different rate limits. Bucket identifies to which part of API the rate limits apply.
totalRequests
Total requests available in the time window.
remainingRequests
Remaining requests available in the time window.
remainingRequestsPercentage
Remaining requests available in the time window in percents.
resetTimestamp
Unix timestamp when the rate limits will reset (in milliseconds).
resetAfter
Number of seconds until reset of rate limit
retryAfter
Number of seconds until user can retry the request

Example

Implementation details

Provider
mock
Use case
GetMessages
Author
@superface
Source
Verified