Messaging API - Send Call Button in Rich Card with RCS

This page walks you step-by-step through how to use the Messaging API to send an RCS message to an end-user that displays a rich card, including both an image and a click-to-call button.

Before You Begin

Make sure you have the following before you start:

  • Transaction Callback Service: You need to have this set up so TeleSign can send you delivery status updates for the message you send through the Messaging API. See Callback Service for more details.
  • RCS Account Details: Before sending a message using RCS, you first need to work with our Customer Support Team to set up an RCS account for you. See Set Up RCS for Your Account for more details.

🚧

CAUTION:

Currently RCS is not supported by iOS devices. We recommend either ensuring your end users have supported devices or including a fallback channel for iOS users.

Steps

Depending on whether you want a vertical rich card (image stacked above button) or a horizontal rich card (image to the side of button), choose the appropriate tab:

Vertical Rich Card

  1. Send a POST /v1/omnichannel request. Include the following param values:
ParameterValueDescriptionRequired?
channelsarray of channel objectsAdd channel objects to the array in the order you want the service to try the channels.yes
channels[0]{"channel":"rcs"}Include rcs as the first channel.yes
channels[0].fallback_timeA time in seconds.Specify the time to wait before cascading to the next channel.no
message.rcs.templaterc_dial_action_verticalSpecify the predefined RCS template that includes a vertically stacked rich card with a click-to-call button in the message.yes
message.rcs.parameters.dial_idAn identifier.A unique ID for this click-to-call phone number.yes
message.rcs.parameters.dial_textSome text.Text to display inside the click-to-call button.yes
message.rcs.parameters.media_urlSome text.The URL where you are hosting your image file for the rich card.yes
message.rcs.parameters.phone_number_to_dialA complete phone number (including country code).The number that the end-user's device dials after they select the click-to-call button.yes
message.sms.templatetextSpecify SMS as your preferred backup channel, using the text template. You can use a different backup channel and template if you prefer.no
message.sms.parameters.textSome text.Text to display in the message.yes (if text template is used for backup)

📘

NOTE:

By using the dial_id parameter, you can change out the phone number used over time without changing data collection that is keyed to the dial ID.

Request Example

POST /v1/omnichannel HTTP/1.1
Content-Type: application/json
Authorization: Basic 12345678-9ABC-DEF0-1234-56789ABCDEF0:vjE/ZDfPvDkuGNsuqCFFO4neYIs=
Host: rest-ww.telesign.com
{
  "channels": [
    {
      "channel": "rcs",
      "fallback_time": 600
    },
    {
      "channel": "sms"
    }
  ],
  "phone_number": "15558675309",
  "message": {
    "rcs": {
      "template": "rc_dial_action_vertical",
      "parameters": {
        "dial_text": "Call to join",
        "phone_number_to_dial": "18007779999",
        "dial_id": "dialid2",
        "media_url":"https://s3.amazonaws.com/viatu-mktg/gold_promo_30.jpg"
      }
    },
    "sms": {
      "template": "text",
      "parameters": {
        "text": "Get 10% off on all orders! Join Viatu Gold by calling 1.800.777.9999."
      }
    }
  },
  "message_type": "MKT"
}
  1. If the request is processed successfully, you should see a response with a 3001 status code.

Response Example

HTTP/1.1 200 OK
Server: nginx/1.17.7
Date: Wed, 14 Oct 2020 21:25:54 GMT
Content-Type: application/json
Content-Length: 137
Connection: keep-alive
Allow: GET,POST,HEAD
{
  "status": {
    "code": 3001,
    "description": "Message in progress"
  },
  "reference_id": "35C8B5D509BC10689196FED2AD551B8A",
  "external_id": null
}
  1. If the send in RCS format is successful, your end-user receives a message on their device that looks like this.
RCS MessageRCS Message

RCS Message

  1. If the send in RCS format fails, the service tries to send the next specified backup channel (if any).
SMS BackupSMS Backup

SMS Backup

  1. Updates on the status of this message are sent to the callback URL for your Transaction Callback Service. The general callback schema common to both this and other products is described on Transaction Callback Service. Modifications to the callback schema for this product are described on Callback Service. Search for these callbacks based on the reference ID in the response to your original Messaging API request. Each callback payload includes an object with the status of the send for each channel that is tried.

Callback Example

GET /callback_endpoint HTTP/1.1
Host: your-callback-url.com
{
  "reference_id": "35C8B5D509BC10689196FED2AD551B8A",
  "external_id": "null",
  "status": {
    "code": 3000,
    "description": "Delivered",
    "last_channel": "sms",
    "updated_on": "2020-05-04 22:07:01:226"
  },
  "channel_status": [
    {"rcs": {
      "code": 3056,
      "description": "Message failed to deliver in specified fallback time",
      "reference_id": "65C77D4A6C5C09085694EFB6C554D2BF",
      "updated_on": "2020-05-04 22:05:00.325"
    }},
    {"sms": {
      "code": 3000,
      "description": "Delivered",
      "reference_id": "65C77D4A6C5C09085694EFB6C558B4C7",
      "updated_on": "2020-05-04 22:07:01:226"
    }}
  ]
}

📘

NOTE:

In addition to the reference ID for the Messaging API transaction itself, the delivery status payload also includes a reference ID for the message-send on each channel. These can be useful for troubleshooting purposes.

Horizontal Rich Card

  1. Send a POST /v1/omnichannel request. Include the following param values:
ParameterValueDescriptionRequired?
channelsarray of channel objectsAdd channel objects to the array in the order you want the service to try the channels.yes
channels[0]{"channel":"rcs"}Include rcs as the first channel.yes
channels[0].fallback_timeA time in milliseconds.Specify the time to wait before cascading to the next channel.no
message.rcs.templaterc_dial_action_horizontalSpecify the predefined RCS template that includes a horizontally arranged rich card with a click-to-call button in the message.yes
message.rcs.parameters.dial_idAn identifier.A unique ID for this click-to-call phone number.yes
message.rcs.parameters.dial_textSome text.Text to display inside the click-to-call button.yes
message.rcs.parameters.media_urlSome text.The URL where you are hosting your image file for the rich card.yes
message.rcs.parameters.phone_number_to_dialA complete phone number (including country code).The number that the end-user's device dials after they select the click-to-call button.yes
message.sms.templatetextSpecify SMS as your preferred backup channel, using the text template. You can use a different backup channel and template if you prefer.no
message.sms.parameters.textSome text.Text to display in the message.yes (if text template is used for backup)

📘

NOTE:

By using the dial_id parameter, you can change out the phone number used over time without changing data collection that is keyed to the dial ID.

Request Example

POST /v1/omnichannel HTTP/1.1
Content-Type: application/json
Authorization: Basic 12345678-9ABC-DEF0-1234-56789ABCDEF0:vjE/ZDfPvDkuGNsuqCFFO4neYIs=
Host: rest-ww.telesign.com
{
  "channels": [
    {
      "channel": "rcs",
      "fallback_time": 600
    },
    {
      "channel": "sms"
    }
  ],
  "phone_number": "15558675309",
  "message": {
    "rcs": {
      "template": "rc_dial_action_horizontal",
      "parameters": {
        "dial_text": "Call to join",
        "phone_number_to_dial": "18007779999",
        "dial_id": "dialid2",
        "media_url":"https://s3.amazonaws.com/viatu-mktg/gold_promo_31.jpg"
      }
    },
    "sms": {
      "template": "text",
      "parameters": {
        "text": "Get 10% off on all orders! Join Viatu Gold by calling 1-800-777-9999."
      }
    }
  },
  "message_type": "MKT"
}
  1. If the request is processed successfully, you should see a response with a 3001 status code.

Response Example

HTTP/1.1 200 OK
Server: nginx/1.17.7
Date: Wed, 14 Oct 2020 21:25:54 GMT
Content-Type: application/json
Content-Length: 137
Connection: keep-alive
Allow: GET,POST,HEAD
{
  "status": {
    "code": 3001,
    "description": "Message in progress"
  },
  "reference_id": "35C8B5D509BC10689196FED2AD551B8A",
  "external_id": null
}
  1. If the send in RCS format is successful, your end-user receives a message on their device that looks like this.
RCS MessageRCS Message

RCS Message

  1. If the send in RCS format fails, the service tries to send the next specified backup channel (if any).
  1. Updates on the status of this message are sent to the callback URL for your Transaction Callback Service. The general callback schema common to both this and other products is described on Transaction Callback Service. Modifications to the callback schema for this product are described on Callback Service. Search for these callbacks based on the reference ID in the response to your original Messaging API request. Each callback payload includes an object with the status of the send for each channel that is tried.

Callback Example

GET /callback_endpoint HTTP/1.1
Host: your-callback-url.com
{
  "reference_id": "35C8B5D509BC10689196FED2AD551B8A",
  "external_id": "null",
  "status": {
    "code": 3000,
    "description": "Delivered",
    "last_channel": "sms",
    "updated_on": "2020-05-04 22:07:01:226"
  },
  "channel_status": [
    {"rcs": {
      "code": 3056,
      "description": "Message failed to deliver in specified fallback time",
      "reference_id": "65C77D4A6C5C09085694EFB6C554D2BF",
      "updated_on": "2020-05-04 22:05:00.325"
    }},
    {"sms": {
      "code": 3000,
      "description": "Delivered",
      "reference_id": "65C77D4A6C5C09085694EFB6C558B4C7",
      "updated_on": "2020-05-04 22:07:01:226"
    }}
  ]
}

📘

NOTE:

In addition to the reference ID for the Messaging API transaction itself, the delivery status payload also includes a reference ID for the message-send on each channel. These can be useful for troubleshooting purposes.


Did this page help you?