The conversations APIs available for inboxes, channels, threads, and messages allow you to retrieve message information, as well as post new messages.
GET
endpoints, or a POST
batch read request to the get actors endpoint, you must have conversations.read
access. All other endpoints require conversations.write
access.
Learn more about authorizing scopes for your app.
Parameter | Type | Description |
---|---|---|
sort | String | Set the sort order of the response. You can sort by multiple properties. |
after | String | The paging cursor token of the last successfully read resource will be returned as the paging.next.after JSON property of a paged response containing more results. |
limit | Integer | The maximum number of results to display per page. |
GET
request to conversations/v3/conversations/inboxes
.
When you make a successful request, the response will include the inbox IDs of the different inboxes set up in your account. To retrieve details about a specific inbox, use the inbox ID to make a GET
request to conversations/v3/conversations/inboxes/{inboxId}
.
GET
request to conversations/v3/conversations/channels
.
When you make a successful request, the response will include the channel IDs for the different channels connected to your inbox. To retrieve a specific channel, use the channel ID to make a GET
request to conversations/v3/conversations/channels/{channelId}
.
You can also retrieve channel accounts, which are instances of a channel that are used to send and receive messages, like a specific chatflow created for one of your chat channels or a team email address connected as an email channel.
To retrieve a list of channel accounts, make a GET
request to conversations/v3/conversations/channel-accounts
. You can limit the results by including the following parameters in the request URL:
Parameter | Description |
---|---|
channelId | The ID of the channel type for which you’re retrieving a channel instance. |
inboxId | The ID of the inbox that the channel is connected to. |
https://api.hubspot.com/conversations/v3/conversations/channel-accounts?channelId=1000&inboxId=448
.
When you make a successful request, the response will include an id
property, which is the channel account ID.
For example, the response may resemble the following:
GET
request to conversations/v3/conversations/channel-accounts/{channelAccountId}
.
GET
request to conversations/v3/conversations/threads
. To filter and search your results, you can use the following query parameters in your request:
Parameter | Type | Description |
---|---|---|
inboxId | Integer | Filter threads by a specific inbox ID. Note that you can only filter a single inbox ID (multiple instances of this query parameter are not supported). |
archived | Boolean | To retrieve archived threads, use the value true . |
sort | String | Set the sort order of the response. Valid options include id , which is the default, and latestMessageTimestamp , which requires the latestMessageTimestampAfter field to also be set. Results are always returned in ascending order. |
after | String | The paging cursor token of the last successfully read resource will be returned as the paging.next.after JSON property of a paged response containing more results. Use this parameter when sorting by ID. |
latestMessageTimestampAfter | String | The minimum latestMessageTimestamp . This is required only when sorting by latestMessageTimestamp . |
limit | Integer | The total number of results to display per page. The maximum limit is 500. |
GET
request to conversations/v3/conversations/threads/{threadId}
.
GET
request to conversations/v3/conversations/threads/{threadId}/messages
.
When you make a successful request, the response will include the message ID, which you can use to retrieve a specific message. To do so, make a GET
request to conversations/v3/conversations/threads/{threadId}/messages/{messageId}
.
For email messages, HubSpot cuts off the reply history section of an email. This is similar to how common mail clients handle reply history and longer emails. When you retrieve a message, the response will include a truncationStatus
field. The value will either be NOT_TRUNCATED
, TRUNCATED_TO_MOST_RECENT_REPLY,
or TRUNCATED
.
If a message is truncated, you can make a GET
request to conversations/v3/conversations/threads/{threadId}/messages/{messageId}/original-content
. This will retrieve the full original version of the message.
associatedContactId
as a query parameter in the URL of your request, along with a threadStatus
parameter, which can be either OPEN
or CLOSED
.
For example, to retrieve open threads associated with a contact whose ID is 53701
, you’d make a GET
request to the following URL:
https://api.hubapi.com/conversations/v3/conversations/threads?associatedContactId=53701&threadStatus=OPEN
Actor Type | Identifier | Description |
---|---|---|
A- | HubSpot user ID (number) | Agent actor, i.e. a user in the account. |
E- | Email address (string) | Email actor. This is used for email addresses that HubSpot didn’t try to resolve to an agent actor or a visitor actor. For example, HubSpot will generally resolve the from email address to a contact, but if an incoming email has any additional email addresses included in the To field, CC field, etc., HubSpot won’t try to resolve those email addresses to contacts. |
I- | App ID (number) | Integration actor. This is used for actions taken by an integration. |
L- | Customer Agent ID (number) | Customer agent actor. This is used for actions taken by Breeze Customer Agent. |
S- | S-hubspot (string) | System actor. This is used for actions taken by the HubSpot system itself. |
V- | Contact ID (number) | Visitor actor. Keep in mind that it’s possible the visitor isn’t a contact yet. |
GET
request to conversations/v3/conversations/threads/{threadId}/messages
, the response will include a sender
and recipient
fields. These fields will include the actor IDs for the visitor or agent. For example, your response may look similar to the following:
GET
request to conversations/v3/conversations/actors/{actorId}
. You will need the actorId
, which is included in the response to a request to get a message or thread. The response will return details like the actor name, email address, avatar, and actor type.
PATCH
request to conversations/v3/conversations/threads/{threadId}
. In the request body, include the thread properties to update.
Field | Description |
---|---|
status | The status of the thread, which can be OPEN or CLOSED . |
PATCH
request to conversations/v3/conversations/threads/{threadId}?archived=true
to retrieve the archived thread, then in the request body set the archived property to false
.
Field | Description |
---|---|
archived | Set to false to restore a thread. |
PATCH
request to this endpoint.DELETE
request to conversations/v3/conversations/threads/{threadId}
.
If you use this endpoint to archive a thread, the thread will be moved to the trash and will be permanently deleted after 30 days. In the section above, learn how to restore a thread before it is permanently deleted.
POST
request to conversations/v3/conversations/threads/{threadId}/messages
. Comments only appear in the inbox and are not sent to visitors.
You can include the following fields in the request body when sending a comment:
Field | Description |
---|---|
type | The type of message you’re sending. This value can either be MESSAGE or COMMENT . |
text | The content of the message. |
richText | The content of the message in HTML format. This is optional. |
attachments | Any attachments to attach to the comment, specified as an object containing a fileId . If you want to include a specific attachment, you can upload it using the Files API before making the call to add the comment. |
POST
request to conversations/v3/conversations/threads/{threadId}/messages
.
When sending a message to a thread, you can include the following fields. You can include both the message details, as well as recipient information, in the request body.
Field | Description |
---|---|
type | The type of message you’re sending. This value can either be MESSAGE or COMMENT . |
text | The content of the message. |
richText | The content of the message in HTML format. This is optional. |
recipients | An object representing the recipients of the message. This is the most important for email, where you can specify multiple recipients. This object includes the following fields:
|
senderActorId | This must be an agent actor ID that is associated to the HubSpot user in the account who is sending the message. |
channelId | The ID of a generic channel returned from the channels endpoint, like 1000 for live chat, 1001 for Facebook Messenger, 1002 for email, etc. |
channelAccountId | The ID of an account that is part of the channelId channel. On an existing thread, it is recommended to copy the channelId and channelAccountId of the most recent message on the thread. |
subject | The subject line of the email. This is ignored when sending a message to a non-email channel. |
attachments | Any attachments to attach to the message, which can be specified as an object that contains a URL to a file hosted in your HubSpot account, or a list of quick replies if you’re sending a message via Facebook Messenger or LiveChat. Learn more about how to include attachments in the section below. |
fileId
in the attachments
field of the request body. For example, the corresponding part of the request body is shown in lines 16-18
below:
attachments
field, which prompt the recipient with certain options that appear as tappable buttons below a message. Once tapped, the corresponding value of that option will be recorded.
Quick replies should be provided as a list of objects that each contain the following fields:
label
: the visible text that appears to the recipient (e.g., Red)value
: the associated value of the button that you want to record (e.g., RED
)valueType
: the type of the quick reply option, which can be either TEXT
or URL
.21-32
:
conversations.read
scope to get access to following webhooks.
The available conversation webhook events are:
Event | Description |
---|---|
conversation.creation | A new thread has been created. |
conversation.deletion | A thread has been archived. |
conversation.privacyDeletion | A thread has been permanently deleted. |
conversation.propertyChange | A property of a thread has been updated. |
conversation.newMessage | A new message has been posted on a thread. |
Event | Properties |
---|---|
All events | objectId : the ID of the Conversations thread that the webhook corresponds to. |
conversation.propertyChange |
|
conversation.newMessage |
|