HubSpot: Retrieve messages
HubSpot conversations.getMessages: arguments, response, policy and SDK examples.
← Conversations operations · Get started
Operation hubspot.conversations_get_messages
Provider route: GET /conversations/conversations/2026-09/threads/{threadId}/messages. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/hubspot with npm, or alter-sdk-hubspot with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { HubSpotIntegration } from "@alter-ai/hubspot";
async function execute(input: Parameters<HubSpotIntegration["conversations"]["getMessages"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new HubSpotIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.conversations.getMessages(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_hubspot import HubSpotIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = HubSpotIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.conversations.get_messages(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.threadId | integer | Required within parent | Format: int64 |
query | object | Optional | Additional keys: not allowed |
query.after | string | Optional | |
query.archived | boolean | Optional | |
query.limit | integer | Optional | Format: int32 |
query.property | string | Optional | |
query.sort | array | Optional | |
query.sort[] | string | Each item |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Retrieve messages — response body |
Referenced models: Retrieve messages — response body
Schemas
Section titled “Schemas”28 more schemas are linked from the tables above, on the schema pages.
Retrieve messages — response body
Referenced models: List threads — response body — paging, Create message — response body — direction: INCOMING, OUTGOING, truncation Status: NOT TRUNCATED, TRUNCATED, TRUNCATED TO MOST RECENT REPLY, type: MESSAGE, Create message — response body — type: ASSIGNMENT, Create message — response body — type: COMMENT, Create message — response body — type: THREAD INBOX CHANGE, Create message — response body — newStatus: CLOSED, OPEN, type: THREAD STATUS CHANGE, Create message — response body — type: WELCOME MESSAGE
List threads — response body — paging
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Paging information for forward-only pagination. Contains the next page reference when more results are available; omitted or empty on the last page. |
next | Model | Optional | Expand List Inboxes — response body — paging next |
Referenced models: List Inboxes — response body — paging next
Create message — response body — direction: INCOMING, OUTGOING, truncation Status: NOT TRUNCATED, TRUNCATED, TRUNCATED TO MOST RECENT REPLY, type: MESSAGE
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
archived | boolean | Required within parent | A boolean indicating whether this message is archived. |
attachments | array | Required within parent | An array of attachments included with this message, which can be of various types such as files, locations, or social media metadata. |
attachments[] | JSON | Each item | |
attachments[] (anyOf 1) | Model | Alternative | Expand Create message — response body — type: COMMENT attachments item file Usage Type: AUDIO, IMAGE, OTHER, STICKER, VOICE RECORDING, type: FILE |
attachments[] (anyOf 2) | Model | Alternative | Expand Create message — response body — type: COMMENT attachments item type: LOCATION |
attachments[] (anyOf 3) | Model | Alternative | Expand Create message — response body — type: COMMENT attachments item type: CONTACT |
attachments[] (anyOf 4) | Model | Alternative | Expand Create message — response body — type: COMMENT attachments item type: UNSUPPORTED CONTENT |
attachments[] (anyOf 5) | Model | Alternative | Expand Create message — response body — type: COMMENT attachments item type: MESSAGE HEADER |
attachments[] (anyOf 6) | Model | Alternative | Expand Create message — response body — type: COMMENT attachments item type: QUICK REPLIES |
attachments[] (anyOf 7) | Model | Alternative | Expand Create message — response body — type: COMMENT attachments item type: WHATSAPP TEMPLATE METADATA |
attachments[] (anyOf 8) | Model | Alternative | Expand Create message — response body — type: COMMENT attachments item type: SOCIAL MEDIA METADATA |
channelAccountId | string | Required within parent | The identifier of the channel account associated with this message. |
channelId | string | Required within parent | The identifier of the channel through which this message was sent. |
client | Model | Required within parent | Expand Create message — response body — type: COMMENT client |
conversationsThreadId | string | Required within parent | The identifier of the conversation thread to which this message belongs. |
createdAt | string | Required within parent | The date and time when this message was created, in ISO 8601 format. Format: date-time |
createdBy | string | Required within parent | The identifier of the actor who created this message. |
direction | string | Required within parent | The direction of the message, indicating whether it is 'INCOMING' or 'OUTGOING'. Known values: INCOMING, OUTGOING |
id | string | Required within parent | The unique identifier for this message. |
inReplyToId | string | Optional | The identifier of the message to which this message is a reply, if applicable. |
recipients | array | Required within parent | An array of recipients of this message, each represented as a PublicRecipient object. |
recipients[] | Model | Each item | Expand Create message — response body — type: COMMENT recipients item |
richText | string | Optional | The rich text content of the message, which may include formatting. |
senders | array | Required within parent | An array of senders involved in this message, each represented as a PublicSender object. |
senders[] | Model | Each item | Expand Create message — response body — type: COMMENT senders item |
status | Model | Optional | Expand Create message — response body — direction: INCOMING, OUTGOING, truncation Status: NOT TRUNCATED, TRUNCATED, TRUNCATED TO MOST RECENT REPLY, type: MESSAGE status |
subject | string | Optional | The subject of the message, if applicable. |
text | string | Required within parent | The plain text content of the message. |
truncationStatus | string | Required within parent | Indicates the truncation status of the message content, with possible values being 'NOT_TRUNCATED', 'TRUNCATED_TO_MOST_RECENT_REPLY', or 'TRUNCATED'. Known values: NOT_TRUNCATED, TRUNCATED, TRUNCATED_TO_MOST_RECENT_REPLY |
type | string | Required within parent | The type of the message, which is always 'MESSAGE'. Known values: MESSAGE Default: MESSAGE |
updatedAt | string | Optional | The date and time when this message was last updated, in ISO 8601 format. Format: date-time |
Referenced models: Create message — response body — type: COMMENT client, Create message — response body — type: COMMENT attachments item type: CONTACT, Create message — response body — type: COMMENT attachments item file Usage Type: AUDIO, IMAGE, OTHER, STICKER, VOICE RECORDING, type: FILE, Create message — response body — type: COMMENT attachments item type: LOCATION, Create message — response body — type: COMMENT attachments item type: MESSAGE HEADER, Create message — response body — direction: INCOMING, OUTGOING, truncation Status: NOT TRUNCATED, TRUNCATED, TRUNCATED TO MOST RECENT REPLY, type: MESSAGE status, Create message — response body — type: COMMENT attachments item type: QUICK REPLIES, Create message — response body — type: COMMENT recipients item, Create message — response body — type: COMMENT senders item, Create message — response body — type: COMMENT attachments item type: SOCIAL MEDIA METADATA, Create message — response body — type: COMMENT attachments item type: UNSUPPORTED CONTENT, Create message — response body — type: COMMENT attachments item type: WHATSAPP TEMPLATE METADATA
List Inboxes — response body — paging next
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Specifies the paging information needed to retrieve the next set of results in a paginated API response |
after | string | Required within parent | A string token used to fetch the next set of results in a paginated response. |
link | string | Optional | A string containing the URL link to the next page of results. |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: hubspot.conversations_get_messages. Catalog operation: conversations_get_messages. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["conversations.read"]