Check out our upcoming events and meetups! View events →
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>",
"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"
},
"encoding": "utf-8",
"received_at": "2023-11-07T05:31:56Z",
"wait_seconds": 0.5
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
RCS message body
RCS Agent ID
"Agent007"
Phone number in +E.164 format
"+13125551234"
A valid messaging profile ID
Show child attributes
Message type - must be set to "RCS"
RCS "RCS"
The URL where webhooks related to this message will be sent.
Show child attributes
Show child attributes
Successful operation
Show child attributes
Was this page helpful?
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>",
"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"
},
"encoding": "utf-8",
"received_at": "2023-11-07T05:31:56Z",
"wait_seconds": 0.5
}
}