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 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.

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

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

Retrieve a single message

Retrieve all message interactions on a message

Retrieving media

Retrieve pre-signed media uploads

For media that you have uploaded to be sent in a channels message you can retrieve this as follows

Retrieve media from incoming messages

For media sent to your channel you can download this media from the following endpoint

Last updated