HubSpot: Publish a message
HubSpot customChannels.createCustomChannel: arguments, response, policy and SDK examples.
← Custom channels operations · Get started
Operation hubspot.custom_channels_create_custom_channel
Provider route: POST /conversations/custom-channels/2026-09/{channelId}/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["customChannels"]["createCustomChannel"]>[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.customChannels.createCustomChannel(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.custom_channels.create_custom_channel(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.channelId | integer | Required within parent | Format: int32 |
body | Model | Required within parent | Expand Publish a message — request body — body |
Referenced models: Publish a 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 Get a message — response body |
Referenced models: Get a message — response body
Schemas
Section titled “Schemas”34 more schemas are linked from the tables above, on the schema pages.
Publish a message — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
associateWithContactId | integer | Optional | The ID of the contact with which this message should be associated. Format: int64 |
attachments | array | Required within parent | An array of attachments included with the message, which can be files, locations, contacts, or other supported types. |
attachments[] | JSON | Each item | |
attachments[] (oneOf 1) | Model | Alternative | Expand Publish a message — request body — body / attachments / item / fileUsageType: AUDIO, IMAGE, OTHER, STICKER, VOICE RECORDING, type: FILE |
attachments[] (oneOf 2) | Model | Alternative | Expand Publish a message — request body — body / attachments / item / type: LOCATION |
attachments[] (oneOf 3) | Model | Alternative | Expand Publish a message — request body — body / attachments / item / type: CONTACT |
attachments[] (oneOf 4) | Model | Alternative | Expand Publish a message — request body — body / attachments / item / type: UNSUPPORTED CONTENT |
attachments[] (oneOf 5) | Model | Alternative | Expand Publish a message — request body — body / attachments / item / type: MESSAGE HEADER |
attachments[] (oneOf 6) | Model | Alternative | Expand Publish a message — request body — body / attachments / item / type: QUICK REPLIES |
attachments[] (oneOf 7) | Model | Alternative | Expand Publish a message — request body — body / attachments / item / type: SOCIAL MEDIA METADATA |
channelAccountId | string | Required within parent | The ID of the channel account through which the message is sent. |
inReplyToId | string | Optional | The ID of the message this message is replying to. |
integrationIdempotencyId | string | Optional | A unique identifier to ensure idempotency of the message within the integration. |
integrationThreadId | string | Optional | A unique identifier for the thread within the integration. |
messageDirection | string | Required within parent | The direction of the message, indicating whether it is 'INCOMING' or 'OUTGOING'. One of: INCOMING, OUTGOING |
preResolvedContacts | Model | Optional | Expand Publish a message — request body — body pre Resolved Contacts |
recipients | array | Required within parent | An array of participants representing the recipients of the message. |
recipients[] | Model | Each item | Expand Publish a message — request body — body senders item |
richText | string | Optional | The rich text content of the message, allowing for formatting. |
senders | array | Required within parent | An array of participants representing the senders of the message. |
senders[] | Model | Each item | Expand Publish a message — request body — body senders item |
text | string | Required within parent | The plain text content of the message. |
timestamp | string | Required within parent | The date and time when the message was created, in ISO 8601 format. Format: date-time |
Referenced models: Publish a message — request body — body senders item, Publish a message — request body — body / attachments / item / type: CONTACT, Publish a message — request body — body / attachments / item / type: SOCIAL MEDIA METADATA, Publish a message — request body — body / attachments / item / fileUsageType: AUDIO, IMAGE, OTHER, STICKER, VOICE RECORDING, type: FILE, Publish a message — request body — body / attachments / item / type: LOCATION, Publish a message — request body — body / attachments / item / type: MESSAGE HEADER, Publish a message — request body — body pre Resolved Contacts, Publish a message — request body — body / attachments / item / type: QUICK REPLIES, Publish a message — request body — body / attachments / item / type: UNSUPPORTED CONTENT
Publish a message — request body — body senders item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
deliveryIdentifier | Model | Required within parent | Expand Create a channel account — request body — body delivery Identifier |
name | string | Optional | The name of the participant. It is a string that can be used to identify the participant within the channel. |
senderActorId | string | Optional | A string representing the unique identifier of the sender actor. This is used to distinguish the sender within the channel integration. |
Referenced models: Create a channel account — request body — body delivery Identifier
Publish a message — request body — body / attachments / item / type: CONTACT
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
contactProfile | Model | Required within parent | Expand Publish a message — request body — body / attachments / item / type: CONTACT contact Profile |
type | string | Required within parent | A string indicating the type of attachment. The default value is 'CONTACT'. Default: CONTACT One of: CONTACT |
Referenced models: Publish a message — request body — body / attachments / item / type: CONTACT contact Profile
Publish a message — request body — body / attachments / item / type: SOCIAL MEDIA METADATA
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
socialMetadata | Model | Required within parent | Expand Publish a message — request body — body / attachments / item / type: SOCIAL MEDIA METADATA social Metadata |
type | string | Required within parent | A string indicating the type of attachment, which is 'SOCIAL_MEDIA_METADATA'. Default: SOCIAL_MEDIA_METADATA One of: SOCIAL_MEDIA_METADATA |
Referenced models: Publish a message — request body — body / attachments / item / type: SOCIAL MEDIA METADATA social Metadata
Publish a message — request body — body / attachments / item / fileUsageType: AUDIO, IMAGE, OTHER, STICKER, VOICE RECORDING, type: FILE
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
fileId | string | Required within parent | A string representing the unique identifier for the file. |
fileUsageType | string | Optional | A string that specifies the usage type of the file. Valid values include 'STICKER', 'VOICE_RECORDING', 'IMAGE', 'AUDIO', and 'OTHER'. One of: AUDIO, IMAGE, OTHER, STICKER, VOICE_RECORDING |
type | string | Required within parent | A string that indicates the type of attachment. The default value is 'FILE'. Default: FILE One of: FILE |
Publish a message — request body — body / attachments / item / type: LOCATION
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
address | string | Optional | A string representing the address of the location. |
latitude | number | Required within parent | A number representing the latitude of the location. |
longitude | number | Required within parent | A number representing the longitude of the location. |
name | string | Optional | A string representing the name of the location. |
type | string | Required within parent | A string indicating the type of attachment, which is always 'LOCATION'. Default: LOCATION One of: LOCATION |
url | string | Optional | A string representing a URL associated with the location. |
Publish a message — request body — body / attachments / item / type: MESSAGE HEADER
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
fileId | integer | Optional | An optional integer representing the ID of an associated file, formatted as an int64. Format: int64 |
text | string | Optional | An optional string containing text information for the message header. |
type | string | Required within parent | A string representing the type of attachment, which is always 'MESSAGE_HEADER'. Default: MESSAGE_HEADER One of: MESSAGE_HEADER |
Publish a message — request body — body pre Resolved Contacts
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
contacts | array | Required within parent | An array of PreResolvedContact objects. Each object contains information about a contact that has been pre-resolved, including properties that led to the match. This array is required. |
contacts[] | Model | Each item | Expand Publish a message — request body — body pre Resolved Contacts contacts item |
Referenced models: Publish a message — request body — body pre Resolved Contacts contacts item
Publish a message — request body — body / attachments / item / type: UNSUPPORTED CONTENT
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
type | string | Required within parent | A string indicating the type of the attachment. The default value is 'UNSUPPORTED_CONTENT'. Default: UNSUPPORTED_CONTENT One of: UNSUPPORTED_CONTENT |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: hubspot.custom_channels_create_custom_channel. Catalog operation: custom_channels_create_custom_channel. 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.custom_channels.write"]