Sending SMS messages

In order to send a message, you must have an active SMS channel and perform a 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 message body field in all cases except for sending a message template when you must only set the template field

Body

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

Template

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

SMS messages

All SMS channels support sending basic text based messages using SMS. The example below must be set in the message body field

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

Send an SMS message

To send an SMS text message set the message body as follows:

 {
  "type": "text",
  "text": {
    "text": "Single text message"
  }
}

MMS messages

SMS channels that are installed with MMS capable numbers (currently numbers purchased for the United States and Canada) also support media messaging. You can also verify if the channel is MMS capable via the API as described here.

Image

Single image message

{
  "type": "image",
  "image": {
    "images": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
      }
    ]
  }
}

Single image message with text

{
  "type": "image",
  "image": {
    "images": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
      }
    ],
    "text": "Single image message"
  }
}

Single image message with text and title

{
  "type": "image",
  "image": {
    "images": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
      }
    ],
    "text": "Single image message",
    "metadata": {
        "subject": "Message subject"
      }
  }
}

Multiple image message

When sending multiple image messages it is possible to send up to an array of 10 media URLs.

{
  "type": "image",
  "image": {
    "images": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
      },
            {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media"
      }
    ]
  }
}

Multiple image message with text

{
  "type": "image",
  "image": {
    "images": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
      },
            {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media"
      }
    ],
    "text": "Multiple images message"
  }
}

Multiple image message with text and title

{
  "type": "image",
  "image": {
    "images": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
      },
            {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media"
      }
    ],
    "text": "Multiple images message",
    "metadata": {
        "subject": "Message subject"
      }
  }
}

File

Single file message

{
  "type": "file",
  "file": {
    "files": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media",
        "contentType": "video/mp4"
      }
    ]
  }
}

Single file message with text

{
  "type": "file",
  "file": {
    "files": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media",
        "contentType": "video/mp4"
      }
    ],
    "text": "Single file message"
  }
}

Single file message with text and title

{
  "type": "file",
  "file": {
    "files": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media",
        "contentType": "video/mp4"
      }
    ],
    "text": "Single file message",
    "metadata": {
        "subject": "Message subject"
      }
  }
}

Multiple file message

{
  "type": "file",
  "file": {
    "files": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media",
        "contentType": "video/mp4"
      },
            {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FbgnxOoaF4aHSHUzMFCna%2Faudio.mp3?alt=media",
        "contentType": "audio/mpeg"
      }
    ],
    "text": "Multiple files message"
  }
}

Multiple file message with text

{
  "type": "file",
  "file": {
    "files": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media",
        "contentType": "video/mp4"
      },
            {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FbgnxOoaF4aHSHUzMFCna%2Faudio.mp3?alt=media",
        "contentType": "audio/mpeg"
      }
    ],
    "text": "Multiple files message"
  }
}

Multiple file message with text and title

{
  "type": "file",
  "file": {
    "files": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media",
        "contentType": "video/mp4"
      },
            {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FbgnxOoaF4aHSHUzMFCna%2Faudio.mp3?alt=media",
        "contentType": "audio/mpeg"
      }
    ],
    "text": "Multiple files message",
    "metadata": {
        "subject": "Message subject"
      }
  }
}

Template messages

Using studio it is possible to create text and media templates that can quickly be reused to send to contacts. Templates must be active before they are used.

The examples below must be set in the message template field

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

Text templates

Text templates will be sent as SMS messages and are compatible with all SMS channels

{  "projectId":"ce6a2fd6-b2fa-4f5a-a2cd-f3bd15883318",
   "version":"latest",
   "locale":"en",
   "parameters":[
      {
         "type":"string",
         "key":"name",
         "value":"Robert"
      }
   ]
}

Last updated