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);{
"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
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
RCS message body
RCS Agent ID
Example:
"Agent007"
Phone number in +E.164 format
Example:
"+13125551234"
A valid messaging profile ID
Show child attributes
Show child attributes
Message type - must be set to "RCS"
Available options:
RCS Example:
"RCS"
The URL where webhooks related to this message will be sent.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
Successful operation
Show child attributes
Show child attributes
Was this page helpful?
⌘I
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);{
"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
}
}