Getting started with the SMS API

Use the RESTful SMS API to send SMS messages to mobiles. The API can be used to send a single message to a mobile, a message to many mobiles, or a set of scheduled messages.

Templates can be used for messages so that message content is already prepared. Phonebooks and distribution lists can also be used to define mobile recipients.

Send a single message

Send a message by specifying a mobile number and message text.

{
  "destination":"447700123123",
  "message":"Hello World"
}

Scheduled messages

Scheduled messages are to remind a person of an appointment or to deliver a sequence of messages at timed intervals. The appointment could be for a haircut or dental check-up, or it could be a reminder to perform a regular task such as to take medication.

Scheduling a single message

{
  "category":"dental-checkup",
  "eventid":"a0a40918-77df-4dd2-a5d7-29efa9e780ee",
  "description":"Routine dental checkup Tue  1 Dec at 11:00AM",
  "mobileno":"+447944654716",
  "message":[{
    "schedule":"2022-11-10T13:49:00.000Z",
    "text":"Mr Bloggs, You have an appointment at No1 Dental Practice on Tue  1 Dec at 11:00AM. If you need to cancel please call 01299 321123"
  }]
}

Scheduling multiple messages

Send a message about an appointment when it is made, and another message the day before the appointment.

{
  "category":"dental-checkup",
  "eventid":"a0a40918-77df-4dd2-a5d7-29efa9e780ee",
  "description":"Routine dental checkup Tue  1 Dec at 11:00AM",
  "mobileno":"+447944654716",
  "message":[{
    "schedule":"2022-11-10T13:49:00.000Z",
    "text":"Mr Bloggs, You have an appointment at No1 Dental Practice on Tue  1 Dec at 11:00AM. If you need to cancel please call 01299 321123"
  },
  {
    "schedule":"2022-11-30T09:30:00.000Z",
    "text":"Mr Bloggs, You have an appointment tomorrow (Tue  1 Dec) at No1 Dental Practice at 11:00AM. If you need to cancel please call 01299 321123"
  }]
}

Scheduling using templates

Use previously defined templates for the message sent when the appointment is made and the message sent the day before the appointment. Template fields contain the details specific to this appointment (i.e. name, appointment date/time) that will be inserted into the templates.

{
  "category":"dental-checkup",
  "eventid":"a0a40918-77df-4dd2-a5d7-29efa9e780ee",
  "description":"Routine dental checkup Tue  1 Dec at 11:00AM",
  "mobileno":"+447944654716",
  "messagetemplated": {
    "fields":[{"name":"Mr Bloggs"},{"appointmentdate":"Tue  1 Dec"},{"appointmenttime":"11:00AM"}],
    "message":[{
      "schedule":"2022-11-10T13:49:00.000Z",
      "template":"4ece7538-62de-4098-8cef-1c0b4145ba6d"
    },
    {
      "schedule":"2022-11-30T09:30:00.000Z",
      "template":"8972a6bf-5c9b-4bab-8c04-705a2a5cbe39"
    }]
  }
}

Define a template

Templates enable predefined messages with fields into which specific details (e.g. name) can be merged when a message is sent to a mobile.

{
  "id":"4ece7538-62de-4098-8cef-1c0b4145ba6d",
  "description":"Routine dental appointment reminder",
  "template":"{{name}}, You have an appointment at No1 Dental Practice on {{appointmenttime}}.If you need to cancel please call 01299 321123"
}

Define a template set

A set of templates can be used to send a sequence of scheduled messages to a mobile.

{
  "id":"4ece7538-62de-4098-8cef-1c0b4145ba6d",
  "description":"Routine dental appointment reminder",
  "templates":[
    {
      "description":"Message when appointment booked",
      "schedule":"immediate",
      "template":"{{name}}, You have an appointment at No1 Dental Practice on {{appointmentdate}} at {{appointmenttime}}.If you need to cancel please call 01299 321123"
    },
    {
      "description":"Message day before appointment",
      "schedule":"24hrs",
      "template":"{{name}}, You have an appointment tomorrow ({{appointmentdate}}) at No1 Dental Practice at {{appointmenttime}}. If you need to cancel please call 01299 321123"
    }
  ]
}