Skip to main content
POST
/
messages
/
rcs
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const response = await client.messages.rcs.send({
  agent_id: 'Agent007',
  agent_message: {},
  messaging_profile_id: 'messaging_profile_id',
  to: '+13125551234',
});

console.log(response.data);
import os
from telnyx import Telnyx

client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.messages.rcs.send(
agent_id="Agent007",
agent_message={},
messaging_profile_id="messaging_profile_id",
to="+13125551234",
)
print(response.data)
package main

import (
"context"
"fmt"

"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)

func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Messages.Rcs.Send(context.TODO(), telnyx.MessageRcSendParams{
AgentID: "Agent007",
AgentMessage: telnyx.RcsAgentMessageParam{},
MessagingProfileID: "messaging_profile_id",
To: "+13125551234",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.messages.RcsAgentMessage;
import com.telnyx.sdk.models.messages.rcs.RcSendParams;
import com.telnyx.sdk.models.messages.rcs.RcSendResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();

RcSendParams params = RcSendParams.builder()
.agentId("Agent007")
.agentMessage(RcsAgentMessage.builder().build())
.messagingProfileId("messaging_profile_id")
.to("+13125551234")
.build();
RcSendResponse response = client.messages().rcs().send(params);
}
}
require "telnyx"

telnyx = Telnyx::Client.new(api_key: "My API Key")

response = telnyx.messages.rcs.send_(
agent_id: "Agent007",
agent_message: {},
messaging_profile_id: "messaging_profile_id",
to: "+13125551234"
)

puts(response)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;

$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');

try {
$response = $client->messages->rcs->send(
agentID: 'Agent007',
agentMessage: [
'contentMessage' => [
'contentInfo' => [
'fileURL' => 'https://example.com/elephant.jpg',
'forceRefresh' => true,
'thumbnailURL' => 'thumbnail_url',
],
'richCard' => [
'carouselCard' => [
'cardContents' => [
[
'description' => 'description',
'media' => [
'contentInfo' => [
'fileURL' => 'https://example.com/elephant.jpg',
'forceRefresh' => true,
'thumbnailURL' => 'thumbnail_url',
],
'height' => 'MEDIUM',
],
'suggestions' => [
[
'action' => [
'createCalendarEventAction' => [
'description' => 'description',
'endTime' => new \DateTimeImmutable(
'2024-10-02T15:02:31Z'
),
'startTime' => new \DateTimeImmutable(
'2024-10-02T15:01:23Z'
),
'title' => 'title',
],
'dialAction' => ['phoneNumber' => '+13125551234'],
'fallbackURL' => 'fallback_url',
'openURLAction' => [
'application' => 'BROWSER',
'url' => 'http://example.com',
'webviewViewMode' => 'HALF',
'description' => 'description',
],
'postbackData' => 'postback_data',
'shareLocationAction' => ['foo' => 'bar'],
'text' => 'Hello world',
'viewLocationAction' => [
'label' => 'label',
'latLong' => ['latitude' => 41.8, 'longitude' => -87.6],
'query' => 'query',
],
],
'reply' => [
'postbackData' => 'postback_data', 'text' => 'text'
],
],
],
'title' => 'Elephant',
],
],
'cardWidth' => 'SMALL',
],
'standaloneCard' => [
'cardContent' => [
'description' => 'description',
'media' => [
'contentInfo' => [
'fileURL' => 'https://example.com/elephant.jpg',
'forceRefresh' => true,
'thumbnailURL' => 'thumbnail_url',
],
'height' => 'MEDIUM',
],
'suggestions' => [
[
'action' => [
'createCalendarEventAction' => [
'description' => 'description',
'endTime' => new \DateTimeImmutable(
'2024-10-02T15:02:31Z'
),
'startTime' => new \DateTimeImmutable(
'2024-10-02T15:01:23Z'
),
'title' => 'title',
],
'dialAction' => ['phoneNumber' => '+13125551234'],
'fallbackURL' => 'fallback_url',
'openURLAction' => [
'application' => 'BROWSER',
'url' => 'http://example.com',
'webviewViewMode' => 'HALF',
'description' => 'description',
],
'postbackData' => 'postback_data',
'shareLocationAction' => ['foo' => 'bar'],
'text' => 'Hello world',
'viewLocationAction' => [
'label' => 'label',
'latLong' => ['latitude' => 41.8, 'longitude' => -87.6],
'query' => 'query',
],
],
'reply' => [
'postbackData' => 'postback_data', 'text' => 'text'
],
],
],
'title' => 'Elephant',
],
'cardOrientation' => 'HORIZONTAL',
'thumbnailImageAlignment' => 'LEFT',
],
],
'suggestions' => [
[
'action' => [
'createCalendarEventAction' => [
'description' => 'description',
'endTime' => new \DateTimeImmutable('2024-10-02T15:02:31Z'),
'startTime' => new \DateTimeImmutable('2024-10-02T15:01:23Z'),
'title' => 'title',
],
'dialAction' => ['phoneNumber' => '+13125551234'],
'fallbackURL' => 'fallback_url',
'openURLAction' => [
'application' => 'BROWSER',
'url' => 'http://example.com',
'webviewViewMode' => 'HALF',
'description' => 'description',
],
'postbackData' => 'postback_data',
'shareLocationAction' => ['foo' => 'bar'],
'text' => 'Hello world',
'viewLocationAction' => [
'label' => 'label',
'latLong' => ['latitude' => 41.8, 'longitude' => -87.6],
'query' => 'query',
],
],
'reply' => ['postbackData' => 'postback_data', 'text' => 'text'],
],
],
'text' => 'Hello world!',
],
'event' => ['eventType' => 'IS_TYPING'],
'expireTime' => new \DateTimeImmutable('2024-10-02T15:01:23Z'),
'ttl' => '10.5s',
],
messagingProfileID: 'messaging_profile_id',
to: '+13125551234',
mmsFallback: [
'from' => '+13125551234',
'mediaURLs' => ['string'],
'subject' => 'Test Message',
'text' => 'Hello world!',
],
smsFallback: ['from' => '+13125551234', 'text' => 'Hello world!'],
type: 'RCS',
webhookURL: 'webhook_url',
);

var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx messages:rcs send \
--api-key 'My API Key' \
--agent-id Agent007 \
--agent-message '{}' \
--messaging-profile-id messaging_profile_id \
--to +13125551234
curl --request POST \
--url https://api.telnyx.com/v2/messages/rcs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "Agent007",
"to": "+13125551234",
"messaging_profile_id": "<string>",
"agent_message": {
"content_message": {
"suggestions": [
{
"reply": {
"text": "<string>",
"postback_data": "<string>"
},
"action": {
"text": "Hello world",
"postback_data": "<string>",
"fallback_url": "<string>",
"view_location_action": {
"label": "<string>",
"query": "<string>"
},
"create_calendar_event_action": {
"start_time": "2024-10-02T15:01:23Z",
"end_time": "2024-10-02T15:02:31Z",
"title": "<string>",
"description": "<string>"
},
"share_location_action": {}
}
}
],
"text": "Hello world!",
"rich_card": {}
},
"event": {
"event_type": "IS_TYPING"
},
"expire_time": "2024-10-02T15:01:23Z",
"ttl": "10.5s"
},
"type": "RCS",
"webhook_url": "<string>",
"sms_fallback": {
"from": "+13125551234",
"text": "Hello world!"
},
"mms_fallback": {
"from": "+13125551234",
"subject": "Test Message",
"media_urls": [
"<string>"
],
"text": "Hello world!"
}
}
'
{
  "data": {
    "record_type": "message",
    "direction": "outbound",
    "id": "4031938e-60e4-4235-a8dd-0b1c55a23e7a",
    "type": "RCS",
    "organization_id": "9f61d8e1-7687-4d6d-9cae-9ff682985983",
    "messaging_profile_id": "4001781e-626f-4a41-a914-b1b682150f94",
    "from": {
      "agent_id": "Agent007",
      "carrier": "Telnyx",
      "agent_name": "Test Agent"
    },
    "to": [
      {
        "phone_number": "+13125551234",
        "status": "queued",
        "carrier": "Verizon Wireless",
        "line_type": "Wireless"
      }
    ],
    "body": {
      "content_message": {
        "suggestions": [
          {
            "reply": {
              "text": "<string>",
              "postback_data": "<string>"
            },
            "action": {
              "text": "Hello world",
              "postback_data": "<string>",
              "fallback_url": "<string>",
              "dial_action": {
                "phone_number": "+13125551234"
              },
              "view_location_action": {
                "lat_long": {
                  "latitude": 41.8,
                  "longitude": -87.6
                },
                "label": "<string>",
                "query": "<string>"
              },
              "create_calendar_event_action": {
                "start_time": "2024-10-02T15:01:23Z",
                "end_time": "2024-10-02T15:02:31Z",
                "title": "<string>",
                "description": "<string>"
              },
              "open_url_action": {
                "url": "http://example.com",
                "application": "BROWSER",
                "webview_view_mode": "HALF",
                "description": "<string>"
              },
              "share_location_action": {}
            }
          }
        ],
        "text": "Hello world!",
        "rich_card": {
          "carousel_card": {
            "card_width": "SMALL",
            "card_contents": [
              {
                "title": "Elephant",
                "description": "<string>",
                "media": {
                  "height": "MEDIUM",
                  "content_info": {
                    "file_url": "https://example.com/elephant.jpg",
                    "thumbnail_url": "<string>",
                    "force_refresh": true
                  }
                },
                "suggestions": [
                  {
                    "reply": {
                      "text": "<string>",
                      "postback_data": "<string>"
                    },
                    "action": {
                      "text": "Hello world",
                      "postback_data": "<string>",
                      "fallback_url": "<string>",
                      "dial_action": {
                        "phone_number": "+13125551234"
                      },
                      "view_location_action": {
                        "lat_long": {
                          "latitude": 41.8,
                          "longitude": -87.6
                        },
                        "label": "<string>",
                        "query": "<string>"
                      },
                      "create_calendar_event_action": {
                        "start_time": "2024-10-02T15:01:23Z",
                        "end_time": "2024-10-02T15:02:31Z",
                        "title": "<string>",
                        "description": "<string>"
                      },
                      "open_url_action": {
                        "url": "http://example.com",
                        "application": "BROWSER",
                        "webview_view_mode": "HALF",
                        "description": "<string>"
                      },
                      "share_location_action": {}
                    }
                  }
                ]
              }
            ]
          },
          "standalone_card": {
            "card_orientation": "HORIZONTAL",
            "thumbnail_image_alignment": "LEFT",
            "card_content": {
              "title": "Elephant",
              "description": "<string>",
              "media": {
                "height": "MEDIUM",
                "content_info": {
                  "file_url": "https://example.com/elephant.jpg",
                  "thumbnail_url": "<string>",
                  "force_refresh": true
                }
              },
              "suggestions": [
                {
                  "reply": {
                    "text": "<string>",
                    "postback_data": "<string>"
                  },
                  "action": {
                    "text": "Hello world",
                    "postback_data": "<string>",
                    "fallback_url": "<string>",
                    "dial_action": {
                      "phone_number": "+13125551234"
                    },
                    "view_location_action": {
                      "lat_long": {
                        "latitude": 41.8,
                        "longitude": -87.6
                      },
                      "label": "<string>",
                      "query": "<string>"
                    },
                    "create_calendar_event_action": {
                      "start_time": "2024-10-02T15:01:23Z",
                      "end_time": "2024-10-02T15:02:31Z",
                      "title": "<string>",
                      "description": "<string>"
                    },
                    "open_url_action": {
                      "url": "http://example.com",
                      "application": "BROWSER",
                      "webview_view_mode": "HALF",
                      "description": "<string>"
                    },
                    "share_location_action": {}
                  }
                }
              ]
            }
          }
        },
        "content_info": {
          "file_url": "https://example.com/elephant.jpg",
          "thumbnail_url": "<string>",
          "force_refresh": true
        }
      },
      "event": {
        "event_type": "IS_TYPING"
      },
      "expire_time": "2024-10-02T15:01:23Z",
      "ttl": "10.5s"
    },
    "encoding": "utf-8",
    "received_at": "2023-11-07T05:31:56Z",
    "wait_seconds": 0.5
  }
}
{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

RCS message body

agent_id
string
required

RCS Agent ID

Example:

"Agent007"

to
string
required

Phone number in +E.164 format

Example:

"+13125551234"

messaging_profile_id
string
required

A valid messaging profile ID

agent_message
object
required
type
enum<string>

Message type - must be set to "RCS"

Available options:
RCS
Example:

"RCS"

webhook_url
string<url>

The URL where webhooks related to this message will be sent.

sms_fallback
object
mms_fallback
object

Response

Successful operation

data
object