HubSpot: Create message
HubSpot conversations.createMessage: arguments, response, policy and SDK examples.
← Conversations operations · Get started
Operation hubspot.conversations_create_message
Provider route: POST /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"]["createMessage"]>[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.createMessage(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.create_message(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 |
body | Model | Required within parent | Expand Create message — request body — body |
Referenced models: Create message — request body — body
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 Create message — response body |
Referenced models: Create message — response body
Schemas
Section titled “Schemas”36 more schemas are linked from the tables above, on the schema pages.
Create message — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (anyOf 1) | Model | Alternative | Expand Create message — response body — direction: INCOMING, OUTGOING, truncation Status: NOT TRUNCATED, TRUNCATED, TRUNCATED TO MOST RECENT REPLY, type: MESSAGE |
$ (anyOf 2) | Model | Alternative | Expand Create message — response body — type: COMMENT |
$ (anyOf 3) | Model | Alternative | Expand Create message — response body — type: WELCOME MESSAGE |
$ (anyOf 4) | Model | Alternative | Expand Create message — response body — type: ASSIGNMENT |
$ (anyOf 5) | Model | Alternative | Expand Create message — response body — newStatus: CLOSED, OPEN, type: THREAD STATUS CHANGE |
$ (anyOf 6) | Model | Alternative | Expand Create message — response body — type: THREAD INBOX CHANGE |
Referenced models: 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
Create message — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | |
$ (oneOf 1) | Model | Alternative | Expand Create message — request body — body / type: MESSAGE |
$ (oneOf 2) | Model | Alternative | Expand Create message — request body — body / type: COMMENT |
Referenced models: Create message — request body — body / type: COMMENT, Create message — request body — body / type: MESSAGE
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
Create message — response body — type: COMMENT client
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
clientType | string | Required within parent | The type of client interacting with the API. Valid values include 'HUBSPOT', 'SYSTEM', 'INTEGRATION', and 'UNKNOWN'. Known values: HUBSPOT, INTEGRATION, SYSTEM, UNKNOWN |
integrationAppId | JSON | Optional | |
integrationAppId (anyOf 1) | integer | Alternative | An optional identifier for the integration application associated with the client. It is an integer value. Format: int32 |
integrationAppId (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: hubspot.conversations_create_message. Catalog operation: conversations_create_message. 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.write"]