Communications
You can log external communications via WhatsApp, LinkedIn, or SMS messages on CRM records to add information about the message to the record timeline.
You can log a message directly in your HubSpot account or using the API endpoints below. You can review all available endpoints on the Endpoints tab at the top of this article.
Create a WhatsApp, LinkedIn, or SMS message
To create a message, make a POST
request to /crm/v3/objects/communications
.
In the request body, add message details in a properties object. You can also add an associations object to associate your new message with an existing record (e.g., contacts, companies).
In the properties object, you can include the following fields:
Field | Description |
---|---|
hs_communication_channel_type |
The channel type of the message that you sent or received from the contact. Supported values are WHATS_APP , LINKEDIN_MESSAGE , or SMS . |
hs_communication_logged_from |
Enum used to differentiate between conversations objects. This must be set to CRM in your request. |
hs_communication_body |
The text body of the engagement. |
hs_timestamp |
This field marks the message's time of creation and determines where the message appears on the record timeline. You can use either a Unix timestamp in milliseconds or UTC format. |
To create and associate a postal mail engagement with existing records, include an associations object in your request. For example, if you want to log an SMS message and associate it with a contact and company, your request body might resemble the following:
In the associations object, you should include the following:
Field | Description |
---|---|
to
| The record you want to associate with the message, specified by its unique |
types
| The type of the association between the message and the record. Include the |
The response to your request will include an ID that you can use to update or associate the message with a record:
You can retrieve messages individually or in batches. To retrieve an individual messages, make a GET
request to /crm/v3/objects/communication/{communicationId}
.
To request a list of all of logged WhatsApp, LinkedIn, and SMS messages, make a GET
request to /crm/v3/objects/communications
.
For both endpoints, you can include the following query parameters in the request URL:
Parameter | Description |
---|---|
properties
| A comma separated list of the properties to be returned in the response. If the requested message doesn't have a value for a property, it will not appear in the response. |
associations
| A comma separated list of object types to retrieve associated IDs for. Any specified associations that don't exist will not be returned in the response. Learn more about the associations API. |
For example, to retrieve messages with their text content and any associated contact IDs, your request URL might look similar to the following:
https://api.hubapi.com/crm/v3/objects/communications?limit=10&properties=hs_communication_body&associations=contact&archived=false
.
Learn more about retrieving a batch of messages by internal ID or unique property value on the Endpoints tab at the top of this article.
You can update messages individually or in batches. To update an individual message by its communication ID, make a PATCH
request to /crm/v3/objects/communications/{communicationId}
.
In the request body, include the message properties that you want to update:
HubSpot will ignore values for read-only and non-existent properties. To clear a property value, pass an empty string for the property in the request body.
Learn more about batch updating messages on the Endpoints tab at the top of this article.
To associate a message with other CRM records, such as a contact, make a PUT
request to /crm/v3/objects/communications/{communicationId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}
. The request URL contains the following fields:
Field | Description |
---|---|
communicationId
| The ID of your WhatsApp, LinkedIn, or SMS message. |
toObjectType
| The type of object that you want to associate the message with (e.g., contact or company) |
toObjectId
| The ID of the record that you want to associate the message with. |
associationTypeId
| A unique identifier to indicate the association type between the message and the other object. The ID can be represented numerically or in snake case (e.g., |
For example, your request URL might look similar to the following:
https://api.hubapi.com/crm/v3/objects/communications/12021896773/associations/contact/581751/communication_to_contact
Remove an association
To remove an association between a message and a record, make a DELETE
request to the same URL as above:
/crm/v3/objects/communications/{communicationId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}
You can pin a message on a record so it remains on the top of the record's timeline. The message must already be associated with the record prior to pinning, and you an only pin one activity per record. To pin a message, include the message's id
in the hs_pinned_engagement_id
field when creating or updating a record via the object APIs. Learn more about using the companies,contacts, deals, tickets, and custom objects APIs.
You can delete messages individually or in batches, which will add the message to the recycling bin in HubSpot. You can later restore the message from the record timeline.
To delete an individual message by its ID, make a DELETE
request to /crm/v3/objects/communications/{communicationId}
.
Learn more about batch deleting messages on the Endpoints tab at the top of this article.
Thank you for your feedback, it means a lot to us.