Sending messages

The Channels API supports many of the features of Google RCS; however, due to the omni-channel nature of the API, there may be some differences between the Channels API message and the native Google RCS API.To send a Google RCS message, you must have an active Google RCS channel and perform an HTTP request to the following endpoint with a valid access key

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-22T02:32:57.212Z",
  "createdAt": "2024-12-22T02:32:57.212Z",
  "updatedAt": "2024-12-22T02:32:57.212Z",
  "details": "text",
  "failure": {
    "code": 0,
    "description": "Unsupported media type",
    "source": {
      "code": "text",
      "name": "text"
    }
  },
  "tags": [
    "text"
  ],
  "shortLinks": {
    "domain": "text"
  },
  "scheduledFor": "2024-12-22T02:32:57.212Z",
  "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 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": {...}
}

You can send messages to users who have opted in to receiving messages from your Google RCS Agent and are also on a carrier that you have launched your Agent with.

The Channels API supports many of the features of Google RCS; however, due to the omni-channel nature of the API, there may be some differences between the Channels API message and the native Google RCS API. Here is an overview of the Google RCS message types and Channels API message types:

Google RCS API type
Channels API

basic message

image

video

location

rich messages + suggestions

rich card

carousel

Supported file types

Content Type
MIME type
Channels API

Image

image/jpeg, image/jpg, image/gif, image/png

Video

video/h263, video/m4v, video/mp4, video/mpeg, video/mpeg4, video/webm

File

application/pdf

Outbound messages

Text

Text message

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

Text message with reply buttons

{
  "type": "text",
  "text": {
    "text": "Single text message with reply actions",
    "actions": [
      {
        "type": "reply",
        "reply": {
          "text": "Reply action 1"
        }
      },
      {
        "type": "reply",
        "reply": {
          "text": "Reply action 2"
        }
      }
    ]
  }
}

Text message with postback actions

{
  "type": "text",
  "text": {
    "text": "Single text message with postback actions",
    "actions": [
      {
        "type": "postback",
        "postback": {
          "text": "Postback action 1",
          "payload": "postback-payload-1"
        }
      },
      {
        "type": "postback",
        "postback": {
          "text": "Postback action 2",
          "payload": "postback-payload-2"
        }
      }
    ]
  }
}

Text message with reply and postback actions

{
  "type": "text",
  "text": {
    "text": "Single text message with reply and postback actions",
    "actions": [
      {
        "type": "postback",
        "postback": {
          "text": "Postback action 1",
          "payload": "postback-payload-1"
        }
      },
      {
        "type": "reply",
        "reply": {
          "text": "Reply action 1"
        }
      }
    ]
  }
}

Image

Single image message

{
  "type": "image",
  "image": {
    "images": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?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%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media"
      }
    ],
    "text": "Single image message"
  }
}

Multiple image message

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

Single image message with postback actions

{
  "type": "image",
  "image": {
    "images": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media"
      }
    ],
    "text": "Single image message with postback actions",
    "actions": [
      {
        "type": "postback",
        "postback": {
          "payload": "postback-payload-1",
          "text": "Postback option 1"
        }
      },
      {
        "postback": {
          "payload": "postback-payload-2",
          "text": "Postback option 2"
        },
        "type": "postback"
      }
    ]
  }
}

Single image message with label and reply actions

{
    "type": "image",
    "image": {
        "images": [
            {
                "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media"
            }
        ],
        "text": "Single image message with reply actions",
        "actions": [
            {
                "type": "reply",
                "reply": {
                    "text": "Reply action 1"
                }
            },
            {
                "type": "reply",
                "reply": {
                    "text": "Reply action 2"
                }
            }
        ]
    }
}

Single image message with label, postback and reply actions

{
  "type": "image",
  "image": {
    "text": "Single image message with postback and reply actions",
    "images": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media"
      }
    ],
    "actions": [
      {
        "type": "postback",
        "postback": {
          "text": "Postback action",
          "payload": "postback-payload"
        }
      },
      {
        "type": "reply",
        "reply": {
          "text": "Reply action"
        }
      }
    ]
  }
}

Multiple images message with labels and postback actions

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

Multiple images message with reply actions

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

Multiple images message with labels, postback and reply actions

{
  "type": "image",
  "image": {
    "images": [
      {
        "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?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 with postback and reply actions",
    "actions": [
      {
        "type": "postback",
        "postback": {
          "payload": "postback-payload",
          "text": "Postback action"
        }
      },
      {
        "reply": {
          "text": "Reply action"
        },
        "type": "reply"
      }
    ]
  }
}

File

Single file message

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

Multiple files message

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

Location

With Coordinates

{
    "type": "location",
    "location": {
        "coordinates": {
            "latitude": 52.37164323041201,
            "longitude": 4.884335169232767
        },
        "location": {
            "label": "MessageBird Amsterdam office"
        }
    }
}

Single card with title, description and actions

{
    "type": "carousel",
    "carousel": {
        "items": [
            {
                "title": "Card 1",
                "description": "First card",
                "actions": [
                    {
                        "type": "reply",
                        "reply": {
                            "text": "reply"
                        }
                    },
                    {
                        "type": "postback",
                        "postback": {
                            "text": "postback",
                            "payload": "postback"
                        }
                    },
                    {
                        "type": "link",
                        "link": {
                            "url": "https://www.messagebird.com",
                            "text": "Visit MessageBird"
                        }
                    }
                ]
            }
        ]
    }
}

Single card with image, title, description and actions

{
    "type": "carousel",
    "carousel": {
        "items": [
            {
                "title": "Card 1",
                "description": "First card",
                "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media",
                "actions": [
                    {
                        "type": "reply",
                        "reply": {
                            "text": "reply"
                        }
                    },
                    {
                        "type": "postback",
                        "postback": {
                            "text": "postback",
                            "payload": "postback"
                        }
                    },
                    {
                        "type": "link",
                        "link": {
                            "url": "https://www.bird.com",
                            "text": "Visit Bird"
                        }
                    }
                ]
            }
        ]
    }
}

Multiple cards with title, description and actions

{
    "type": "carousel",
    "carousel": {
        "items": [
            {
                "title": "Card 1",
                "description": "First card",
                "actions": [
                    {
                        "type": "reply",
                        "reply": {
                            "text": "reply"
                        }
                    },
                    {
                        "type": "postback",
                        "postback": {
                            "text": "postback",
                            "payload": "postback"
                        }
                    },
                    {
                        "type": "link",
                        "link": {
                            "url": "https://www.bird.com",
                            "text": "Visit Bird"
                        }
                    }
                ]
            },
            {
                "title": "Card 2",
                "description": "Second card",
                "actions": [
                    {
                        "type": "reply",
                        "reply": {
                            "text": "reply"
                        }
                    },
                    {
                        "type": "postback",
                        "postback": {
                            "text": "postback",
                            "payload": "postback"
                        }
                    },
                    {
                        "type": "link",
                        "link": {
                            "url": "https://www.bird.com",
                            "text": "Visit Bird"
                        }
                    }
                ]
            },
            {
                "title": "Card 3",
                "description": "Third card",
                "actions": [
                    {
                        "type": "reply",
                        "reply": {
                            "text": "reply"
                        }
                    },
                    {
                        "type": "postback",
                        "postback": {
                            "text": "postback",
                            "payload": "postback"
                        }
                    },
                    {
                        "type": "link",
                        "link": {
                            "url": "https://www.bird.com",
                            "text": "Visit Bird"
                        }
                    }
                ]
            }
        ]
    }
}

Multiple cards with image title, description and actions

{
    "type": "carousel",
    "carousel": {
        "items": [
            {
                "title": "Card 1",
                "description": "First card",
                "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media",
                "actions": [
                    {
                        "type": "reply",
                        "reply": {
                            "text": "reply"
                        }
                    },
                    {
                        "type": "postback",
                        "postback": {
                            "text": "postback",
                            "payload": "postback"
                        }
                    },
                    {
                        "type": "link",
                        "link": {
                            "url": "https://www.bird.com",
                            "text": "Visit Bird"
                        }
                    }
                ]
            },
            {
                "title": "Card 2",
                "description": "Second card",
                "mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media",
                "actions": [
                    {
                        "type": "reply",
                        "reply": {
                            "text": "reply"
                        }
                    },
                    {
                        "type": "postback",
                        "postback": {
                            "text": "postback",
                            "payload": "postback"
                        }
                    },
                    {
                        "type": "link",
                        "link": {
                            "url": "https://www.bird.com",
                            "text": "Visit Bird"
                        }
                    }
                ]
            }
        ]
    }
}

Template

Basic text template with variable

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

Rich card template with button and variables

{  "projectId":"2bbf6fe2-7297-454d-9e8c-1419e21be803",
   "version":"latest",
   "locale":"en",
   "parameters":[
      {
         "type":"string",
         "key":"imageURL",
         "value":"https://pbs.twimg.com/profile_images/1546538670936801280/ZBIxKfMq_400x400.jpg"
      },
      {
         "type":"string",
         "key":"name",
         "value":"Robert"
      }
   ]
}

Last updated