Messaging

Sending messages

In order to send a message you must have an active channel and perform an HTTP request to the following endpoint with a valid access key

When you send a message, a contact is automatically created with a contactId matching the receiver's identifier if one doesn't already exist. For instance, sending an email generates a contact with an email identifier, while sending an SMS creates one with a phone number identifier.

Send a message

Send a message to a channel

POST/workspaces/{workspaceId}/channels/{channelId}/messages
Authorization
Path parameters
workspaceId*string (uuid)

The ID of the workspace

channelId*string (uuid)

The ID for a channel

Body
senderSender (object)
receiver*Receiver (object)
referenceReference (string)

A reference to the message. This can be used to identify the message in the channel.

Example: "my-own-identifier"
templatenullable Template (object)
metaMeta (object)
replyToReplyTo (object)
bodyMessageBody
notificationChannelNotification
capFrequencyboolean

If set to true, the frequency capping settings of the platform will be used to either allow or reject the message to a contact. Can only be set to true if the message is sent to a contact and .meta.extraInformation.useCase is marketing.

enableLinkTrackingboolean

If set to true and message is a test/campaign message, web tracking parameters will be appended to the links in the message.

ignoreQuietHoursboolean

If set to true, quiet hours settings will be ignored and the message will be sent as soon as possible.

ignoreGlobalHoldoutboolean

Do not check if the recipient is part of global holdout. To be used to send transactional messages.

tagsTags (array of Name-3 (string))

Tags to associate with the message. Tags are converted to lower case and tags that do not exist are automatically created. You can view your created tags in the UI. You can specify up to 10 tags per message.

shortLinksnullable ShortLinks (object)

SMS link shortening options. When using templates, please refer to the template level shortLinks instead.

scheduledForScheduledFor (string (date-time))

Scheduled time to send message at. Must be formated as RFC3339 timestamp. When set, the message status will be scheduled until it's sent. Messages scheduled for a time in the past or within 10 minutes of the request may be sent immediately. Messages scheduled farther than 35 days will be rejected.

validityValidity (integer)

Validity determines for how many seconds a message is valid. If none is provided, the channel message type will be used to determine it. A promotional, conversational or transactional channel message is valid for 36 hours (129600 seconds). A message sent from a 2FA channel is valid for 10 minutes (600 seconds).

any of
Response

Message was accepted for processing

Body
id*Id-2 (string (uuid))
channelId*ChannelId (string (uuid))
sender*one of
receiver*one of
metaMeta (object)
referenceReference (string)

A reference to the message. This can be used to identify the message in the channel.

Example: "my-own-identifier"
partsParts (array of object)
status*Status-3 (enum)
acceptedrejectedprocessingscheduledsentsending_faileddelivereddelivery_faileddeletedskipped
reasonstring
directionDirection (enum)
incomingoutgoing
originnullable Origin (object)
replyToReplyTo (object)
lastStatusAt*string (date-time)
createdAt*string (date-time)
updatedAt*string (date-time)
detailsstring

This field is used to store additional information related to the message status.

failurenullable Failure (object)
tagsTags (array of Name-3 (string))

Tags to associate with the message. Tags are converted to lower case and tags that do not exist are automatically created. You can view your created tags in the UI. You can specify up to 10 tags per message.

shortLinksnullable ShortLinks (object)

SMS link shortening options. When using templates, please refer to the template level shortLinks instead.

scheduledForScheduledFor (string (date-time))

Scheduled time to send message at. Must be formated as RFC3339 timestamp. When set, the message status will be scheduled until it's sent. Messages scheduled for a time in the past or within 10 minutes of the request may be sent immediately. Messages scheduled farther than 35 days will be rejected.

any of
Request
const response = await fetch('/workspaces/{workspaceId}/channels/{channelId}/messages', {
    method: 'POST',
    headers: {
      "Authorization": "Bearer jwt",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "receiver": {}
    }),
});
const data = await response.json();
Response
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "channelId": "123e4567-e89b-12d3-a456-426614174000",
  "sender": {
    "connector": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "identifierValue": "text",
      "annotations": {
        "name": "text"
      },
      "types": [
        "text"
      ]
    }
  },
  "receiver": {
    "connector": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "identifierValue": "text",
      "annotations": {
        "name": "text"
      },
      "types": [
        "text"
      ]
    }
  },
  "meta": {
    "referral": {
      "source": "text",
      "title": "text",
      "text": "text",
      "group": "text",
      "metadata": {
        "source_id": "text",
        "source_url": "text",
        "media_url": "text",
        "tracking_id": "text"
      }
    },
    "order": {
      "products": [
        {
          "externalCatalogId": "text",
          "externalProductId": "text",
          "quantity": 0,
          "price": {
            "amount": 0,
            "exponent": 0,
            "currencyCode": "text"
          }
        }
      ]
    },
    "referredProduct": {
      "externalCatalogId": "text",
      "externalProductId": "text"
    },
    "email": {
      "subject": "text",
      "from": {
        "username": "text",
        "displayName": "text"
      }
    },
    "pushNotifications": {
      "gatewayTypeOverride": "apns"
    },
    "navigatorId": "123e4567-e89b-12d3-a456-426614174000",
    "navigatorMessageId": "123e4567-e89b-12d3-a456-426614174000",
    "flow": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "text",
      "stepId": "text",
      "runId": "123e4567-e89b-12d3-a456-426614174000"
    },
    "journey": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "text",
      "stepId": "text",
      "runId": "123e4567-e89b-12d3-a456-426614174000"
    },
    "campaign": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "text"
    }
  },
  "reference": "my-own-identifier",
  "parts": [
    {
      "platformReference": "text"
    }
  ],
  "status": "accepted",
  "reason": "text",
  "direction": "incoming",
  "origin": {
    "type": "text",
    "id": "text"
  },
  "replyTo": {
    "id": "text",
    "order": 0,
    "type": "message"
  },
  "lastStatusAt": "2024-12-08T00:52:35.092Z",
  "createdAt": "2024-12-08T00:52:35.092Z",
  "updatedAt": "2024-12-08T00:52:35.092Z",
  "details": "text",
  "failure": {
    "code": 0,
    "description": "Unsupported media type",
    "source": {
      "code": "text",
      "name": "text"
    }
  },
  "tags": [
    "text"
  ],
  "shortLinks": {
    "domain": "text"
  },
  "scheduledFor": "2024-12-08T00:52:35.092Z",
  "body": {
    "type": "text",
    "text": {
      "text": "text",
      "attachments": [
        {
          "mediaUrl": "https://example.com",
          "filename": "text",
          "inline": false
        }
      ],
      "actions": [
        {
          "type": "link",
          "link": {
            "text": "text",
            "url": "text"
          }
        }
      ],
      "metadata": {
        "subject": "text",
        "whatsapp": {
          "previewUrl": false
        },
        "line": {
          "emoji": {
            "items": [
              {
                "index": 0,
                "productId": "text",
                "emojiId": "text",
                "length": 0
              }
            ]
          }
        },
        "telegram": {
          "parseMode": "Markdown"
        }
      }
    }
  }
}

When sending outbound messages as well as setting the receiver information you must set the message body field in all cases except for sending a message template when you must only set the templatefield.

Multiple recipient messages are only possible through the Email platform. For other platforms, a message with multiple reciever entries will be rejected.

Body

{
 "receiver": {
   "contacts": [
     {
       "identifierValue": "+31612345678"
     }
   ]
 },
 "body": {...},
}

Template

{
 "receiver": {
   "contacts": [
     {
       "identifierValue": "+31612345678"
     }
   ]
 },
 "template": {...},
}

Uploading media

When sending messages that contain media links these must be publicly accessible. Otherwise you can upload media by creating requesting a pre-signed media URL. Firstly make a POST request to the following endpoint with the content type of the media you will be uploading set in the request body.

There are two methods for generating a presigned URL: one is channel-independent, allowing it to be used across any channel, while the other restricts usage to a specified channel ID.

Create a presigned media upload

POST/workspaces/{workspaceId}/channel-media/presigned-upload
Authorization
Path parameters
workspaceId*string (uuid)

The ID of the workspace

Body
contentType*string
Response

OK

Body
mediaUrl*string (uri)
uploadUrl*string (uri)
uploadMethod*string
uploadFormData*object
Request
const response = await fetch('/workspaces/{workspaceId}/channel-media/presigned-upload', {
    method: 'POST',
    headers: {
      "Authorization": "Bearer jwt",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "contentType": "text"
    }),
});
const data = await response.json();
Response
{
  "mediaUrl": "https://example.com",
  "uploadUrl": "https://example.com",
  "uploadMethod": "text"
}

Create a presigned media upload

POST/workspaces/{workspaceId}/channels/{channelId}/presigned-upload
Authorization
Path parameters
workspaceId*string (uuid)

The ID of the workspace

channelId*string (uuid)

The ID for a channel

Body
contentType*string
Response

OK

Body
mediaUrl*string (uri)
uploadUrl*string (uri)
uploadMethod*string
uploadFormData*object
Request
const response = await fetch('/workspaces/{workspaceId}/channels/{channelId}/presigned-upload', {
    method: 'POST',
    headers: {
      "Authorization": "Bearer jwt",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "contentType": "text"
    }),
});
const data = await response.json();
Response
{
  "mediaUrl": "https://example.com",
  "uploadUrl": "https://example.com",
  "uploadMethod": "text"
}

From the response you will get the following details:

mediaUrl: This will be the URL you set in any message bodies where you send the uploaded media

uploadUrl: This is the URL you will need to make a request to to upload your media file

uploadMethod: This is the HTTP method to make an upload i.e. POST

uploadFormData: Set this as the fields in form-data of your POST request along with an additional field called file. This should include your file data. An example using CURL

No need to specify any AccessKey on the below call as all the required data is provided in the form data.

curl -X POST \
  # uploadFormData
  -F Content-Type='...' \
  -F acl='private' \
  -F bucket='channels..' \
  -F key='b2d..b123' \
  -F policy='eyJle...dfQ==' \
  -F x-amz-algorithm='AWS4-HMAC-SHA256' \
  -F x-amz-credential='ASIA..' \
  -F x-amz-date='20230501T192504Z' \
  -F x-amz-meta-allowed-paths='workspace\b2..' \
  -F x-amz-meta-channel-id='ac0..f19e' \
  -F x-amz-security-token='IQoo..qqq' \
  -F x-amz-signature='RcU9...XLw=' \
  # the file to upload
  -F file=@local-filename.txt \
  # the URL
  https://channels...s3.amazonaws.com/

Once you have uploaded the file using the mediaUrl, this should be used as the URL when sending messages with media.

Retrieving messages

Retrieve a list of messages of a channel

List messages by channel ID

It retrieves a list of messages from a given channel ID

GET/workspaces/{workspaceId}/channels/{channelId}/messages
Authorization
Path parameters
workspaceId*string (uuid)

The ID of the workspace

channelId*string (uuid)

The ID for a channel

Query parameters
Response

OK

Body
startAtnullable string (date-time)
endAtnullable string (date-time)
nextPageTokenstring
results*array of ChannelMessage
nextPageTokenstring

The token that can be passed as pageToken in URL to retrieve the next set of results. If missing, no more results to display.

Request
const response = await fetch('/workspaces/{workspaceId}/channels/{channelId}/messages', {
    method: 'GET',
    headers: {
      "Authorization": "Bearer jwt"
    },
});
const data = await response.json();
Response
{
  "startAt": "2024-12-08T00:52:35.092Z",
  "endAt": "2024-12-08T00:52:35.092Z",
  "nextPageToken": "text",
  "results": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "channelId": "123e4567-e89b-12d3-a456-426614174000",
      "sender": {
        "connector": {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "identifierValue": "text",
          "annotations": {
            "name": "text"
          },
          "types": [
            "text"
          ]
        }
      },
      "receiver": {
        "connector": {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "identifierValue": "text",
          "annotations": {
            "name": "text"
          },
          "types": [
            "text"
          ]
        }
      },
      "meta": {
        "referral": {
          "source": "text",
          "title": "text",
          "text": "text",
          "group": "text",
          "metadata": {
            "source_id": "text",
            "source_url": "text",
            "media_url": "text",
            "tracking_id": "text"
          }
        },
        "order": {
          "products": [
            {
              "externalCatalogId": "text",
              "externalProductId": "text",
              "quantity": 0,
              "price": {
                "amount": 0,
                "exponent": 0,
                "currencyCode": "text"
              }
            }
          ]
        },
        "referredProduct": {
          "externalCatalogId": "text",
          "externalProductId": "text"
        },
        "email": {
          "subject": "text",
          "from": {
            "username": "text",
            "displayName": "text"
          }
        },
        "pushNotifications": {
          "gatewayTypeOverride": "apns"
        },
        "navigatorId": "123e4567-e89b-12d3-a456-426614174000",
        "navigatorMessageId": "123e4567-e89b-12d3-a456-426614174000",
        "flow": {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "name": "text",
          "stepId": "text",
          "runId": "123e4567-e89b-12d3-a456-426614174000"
        },
        "journey": {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "name": "text",
          "stepId": "text",
          "runId": "123e4567-e89b-12d3-a456-426614174000"
        },
        "campaign": {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "name": "text"
        }
      },
      "reference": "my-own-identifier",
      "parts": [
        {
          "platformReference": "text"
        }
      ],
      "status": "accepted",
      "reason": "text",
      "direction": "incoming",
      "origin": {
        "type": "text",
        "id": "text"
      },
      "replyTo": {
        "id": "text",
        "order": 0,
        "type": "message"
      },
      "lastStatusAt": "2024-12-08T00:52:35.092Z",
      "createdAt": "2024-12-08T00:52:35.092Z",
      "updatedAt": "2024-12-08T00:52:35.092Z",
      "details": "text",
      "failure": {
        "code": 0,
        "description": "Unsupported media type",
        "source": {
          "code": "text",
          "name": "text"
        }
      },
      "tags": [
        "text"
      ],
      "shortLinks": {
        "domain": "text"
      },
      "scheduledFor": "2024-12-08T00:52:35.092Z",
      "body": {
        "type": "text",
        "text": {
          "text": "text",
          "attachments": [
            {
              "mediaUrl": "https://example.com",
              "filename": "text",
              "inline": false
            }
          ],
          "actions": [
            {
              "type": "link",
              "link": {
                "text": "text",
                "url": "text"
              }
            }
          ],
          "metadata": {
            "subject": "text",
            "whatsapp": {
              "previewUrl": false
            },
            "line": {
              "emoji": {
                "items": [
                  {
                    "index": 0,
                    "productId": "text",
                    "emojiId": "text",
                    "length": 0
                  }
                ]
              }
            },
            "telegram": {
              "parseMode": "Markdown"
            }
          }
        }
      }
    }
  ]
}

Retrieve list of messages of a workspace

Retrieve a single message

Get message by message ID

Get a channel message

GET/workspaces/{workspaceId}/channels/{channelId}/messages/{messageId}
Authorization
Path parameters
workspaceId*string (uuid)

The ID of the workspace

messageId*string (uuid)

The ID for a message

channelId*string (uuid)

The ID for a channel

Response

OK

Body
id*Id-2 (string (uuid))
channelId*ChannelId (string (uuid))
sender*one of
receiver*one of
metaMeta (object)
referenceReference (string)

A reference to the message. This can be used to identify the message in the channel.

Example: "my-own-identifier"
partsParts (array of object)
status*Status-3 (enum)
acceptedrejectedprocessingscheduledsentsending_faileddelivereddelivery_faileddeletedskipped
reasonstring
directionDirection (enum)
incomingoutgoing
originnullable Origin (object)
replyToReplyTo (object)
lastStatusAt*string (date-time)
createdAt*string (date-time)
updatedAt*string (date-time)
detailsstring

This field is used to store additional information related to the message status.

failurenullable Failure (object)
tagsTags (array of Name-3 (string))

Tags to associate with the message. Tags are converted to lower case and tags that do not exist are automatically created. You can view your created tags in the UI. You can specify up to 10 tags per message.

shortLinksnullable ShortLinks (object)

SMS link shortening options. When using templates, please refer to the template level shortLinks instead.

scheduledForScheduledFor (string (date-time))

Scheduled time to send message at. Must be formated as RFC3339 timestamp. When set, the message status will be scheduled until it's sent. Messages scheduled for a time in the past or within 10 minutes of the request may be sent immediately. Messages scheduled farther than 35 days will be rejected.

any of
Request
const response = await fetch('/workspaces/{workspaceId}/channels/{channelId}/messages/{messageId}', {
    method: 'GET',
    headers: {
      "Authorization": "Bearer jwt"
    },
});
const data = await response.json();
Response
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "channelId": "123e4567-e89b-12d3-a456-426614174000",
  "sender": {
    "connector": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "identifierValue": "text",
      "annotations": {
        "name": "text"
      },
      "types": [
        "text"
      ]
    }
  },
  "receiver": {
    "connector": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "identifierValue": "text",
      "annotations": {
        "name": "text"
      },
      "types": [
        "text"
      ]
    }
  },
  "meta": {
    "referral": {
      "source": "text",
      "title": "text",
      "text": "text",
      "group": "text",
      "metadata": {
        "source_id": "text",
        "source_url": "text",
        "media_url": "text",
        "tracking_id": "text"
      }
    },
    "order": {
      "products": [
        {
          "externalCatalogId": "text",
          "externalProductId": "text",
          "quantity": 0,
          "price": {
            "amount": 0,
            "exponent": 0,
            "currencyCode": "text"
          }
        }
      ]
    },
    "referredProduct": {
      "externalCatalogId": "text",
      "externalProductId": "text"
    },
    "email": {
      "subject": "text",
      "from": {
        "username": "text",
        "displayName": "text"
      }
    },
    "pushNotifications": {
      "gatewayTypeOverride": "apns"
    },
    "navigatorId": "123e4567-e89b-12d3-a456-426614174000",
    "navigatorMessageId": "123e4567-e89b-12d3-a456-426614174000",
    "flow": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "text",
      "stepId": "text",
      "runId": "123e4567-e89b-12d3-a456-426614174000"
    },
    "journey": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "text",
      "stepId": "text",
      "runId": "123e4567-e89b-12d3-a456-426614174000"
    },
    "campaign": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "text"
    }
  },
  "reference": "my-own-identifier",
  "parts": [
    {
      "platformReference": "text"
    }
  ],
  "status": "accepted",
  "reason": "text",
  "direction": "incoming",
  "origin": {
    "type": "text",
    "id": "text"
  },
  "replyTo": {
    "id": "text",
    "order": 0,
    "type": "message"
  },
  "lastStatusAt": "2024-12-08T00:52:35.092Z",
  "createdAt": "2024-12-08T00:52:35.092Z",
  "updatedAt": "2024-12-08T00:52:35.092Z",
  "details": "text",
  "failure": {
    "code": 0,
    "description": "Unsupported media type",
    "source": {
      "code": "text",
      "name": "text"
    }
  },
  "tags": [
    "text"
  ],
  "shortLinks": {
    "domain": "text"
  },
  "scheduledFor": "2024-12-08T00:52:35.092Z",
  "body": {
    "type": "text",
    "text": {
      "text": "text",
      "attachments": [
        {
          "mediaUrl": "https://example.com",
          "filename": "text",
          "inline": false
        }
      ],
      "actions": [
        {
          "type": "link",
          "link": {
            "text": "text",
            "url": "text"
          }
        }
      ],
      "metadata": {
        "subject": "text",
        "whatsapp": {
          "previewUrl": false
        },
        "line": {
          "emoji": {
            "items": [
              {
                "index": 0,
                "productId": "text",
                "emojiId": "text",
                "length": 0
              }
            ]
          }
        },
        "telegram": {
          "parseMode": "Markdown"
        }