import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const response = await client.messages.sendNumberPool({
messaging_profile_id: 'abc85f64-5717-4562-b3fc-2c9600000000',
to: 'to',
});
console.log(response.data);{
"data": {
"record_type": "message",
"direction": "outbound",
"id": "40385f64-5717-4562-b3fc-2c963f66afa6",
"type": "MMS",
"messaging_profile_id": "4000eba1-a0c0-4563-9925-b25e842a7cb6",
"organization_id": "b448f9cc-a842-4784-98e9-03c1a5872950",
"from": {
"phone_number": "+18445550001",
"carrier": "TELNYX LLC",
"line_type": "VoIP"
},
"to": [
{
"phone_number": "+18665550001",
"status": "queued",
"carrier": "T-MOBILE USA, INC.",
"line_type": "Wireless"
}
],
"cc": [],
"text": "Hello, World!",
"subject": "From Telnyx!",
"media": [
{
"url": "https://pbs.twimg.com/profile_images/1142168442042118144/AW3F4fFD_400x400.png",
"content_type": null,
"sha256": null,
"size": null
}
],
"webhook_url": "https://www.example.com/hooks",
"webhook_failover_url": "https://backup.example.com/hooks",
"encoding": "GSM-7",
"parts": 1,
"tags": [
"Greetings"
],
"cost": {
"amount": 0.0051,
"currency": "USD"
},
"cost_breakdown": {
"carrier_fee": {
"amount": 0.00305,
"currency": "USD"
},
"rate": {
"amount": 0.00205,
"currency": "USD"
}
},
"tcr_campaign_id": "TCPA3X7",
"tcr_campaign_billable": true,
"tcr_campaign_registered": "REGISTERED",
"received_at": "2019-01-23T18:10:02.574Z",
"sent_at": null,
"completed_at": null,
"valid_until": null,
"errors": []
}
}import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const response = await client.messages.sendNumberPool({
messaging_profile_id: 'abc85f64-5717-4562-b3fc-2c9600000000',
to: 'to',
});
console.log(response.data);{
"data": {
"record_type": "message",
"direction": "outbound",
"id": "40385f64-5717-4562-b3fc-2c963f66afa6",
"type": "MMS",
"messaging_profile_id": "4000eba1-a0c0-4563-9925-b25e842a7cb6",
"organization_id": "b448f9cc-a842-4784-98e9-03c1a5872950",
"from": {
"phone_number": "+18445550001",
"carrier": "TELNYX LLC",
"line_type": "VoIP"
},
"to": [
{
"phone_number": "+18665550001",
"status": "queued",
"carrier": "T-MOBILE USA, INC.",
"line_type": "Wireless"
}
],
"cc": [],
"text": "Hello, World!",
"subject": "From Telnyx!",
"media": [
{
"url": "https://pbs.twimg.com/profile_images/1142168442042118144/AW3F4fFD_400x400.png",
"content_type": null,
"sha256": null,
"size": null
}
],
"webhook_url": "https://www.example.com/hooks",
"webhook_failover_url": "https://backup.example.com/hooks",
"encoding": "GSM-7",
"parts": 1,
"tags": [
"Greetings"
],
"cost": {
"amount": 0.0051,
"currency": "USD"
},
"cost_breakdown": {
"carrier_fee": {
"amount": 0.00305,
"currency": "USD"
},
"rate": {
"amount": 0.00205,
"currency": "USD"
}
},
"tcr_campaign_id": "TCPA3X7",
"tcr_campaign_billable": true,
"tcr_campaign_registered": "REGISTERED",
"received_at": "2019-01-23T18:10:02.574Z",
"sent_at": null,
"completed_at": null,
"valid_until": null,
"errors": []
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Message payload
Unique identifier for a messaging profile.
Receiving address (+E.164 formatted phone number or short code).
"+E.164"
Message body (i.e., content) as a non-empty string.
Required for SMS
Subject of multimedia message
A list of media URLs. The total media size must be less than 1 MB.
Required for MMS
The URL where webhooks related to this message will be sent.
The failover URL where webhooks related to this message will be sent if sending to the primary URL fails.
If the profile this number is associated with has webhooks, use them for delivery notifications. If webhooks are also specified on the message itself, they will be attempted first, then those on the profile.
The protocol for sending the message, either SMS or MMS.
SMS, MMS Automatically detect if an SMS message is unusually long and exceeds a recommended limit of message parts.
Successful response with details about a message.
Show child attributes
Identifies the type of the resource.
message "message"
The direction of the message. Inbound messages are sent to you whereas outbound messages are sent from you.
outbound "outbound"
Identifies the type of resource.
The type of message.
SMS, MMS Unique identifier for a messaging profile.
The id of the organization the messaging profile belongs to.
Show child attributes
Sending address (+E.164 formatted phone number, alphanumeric sender ID, or short code).
The carrier of the receiver.
The line-type of the receiver.
Wireline, Wireless, VoWiFi, VoIP, Pre-Paid Wireless, Show child attributes
Receiving address (+E.164 formatted phone number or short code).
The delivery status of the message.
queued, sending, sent, expired, sending_failed, delivery_unconfirmed, delivered, delivery_failed The carrier of the receiver.
The line-type of the receiver.
Wireline, Wireless, VoWiFi, VoIP, Pre-Paid Wireless, Message body (i.e., content) as a non-empty string.
Required for SMS
Subject of multimedia message
Show child attributes
The URL where webhooks related to this message will be sent.
The failover URL where webhooks related to this message will be sent if sending to the primary URL fails.
Encoding scheme used for the message body.
Number of parts into which the message's body must be split.
1 <= x <= 10Tags associated with the resource.
Detailed breakdown of the message cost components.
Show child attributes
The Campaign Registry (TCR) campaign ID associated with the message.
Indicates whether the TCR campaign is billable.
The registration status of the TCR campaign.
"REGISTERED"
ISO 8601 formatted date indicating when the message request was received.
ISO 8601 formatted date indicating when the message was sent.
ISO 8601 formatted date indicating when the message was finalized.
Message must be out of the queue by this time or else it will be discarded and marked as 'sending_failed'. Once the message moves out of the queue, this field will be nulled
These errors may point at addressees when referring to unsuccessful/unconfirmed delivery statuses.
Show child attributes
{
"record_type": "message",
"direction": "outbound",
"id": "40385f64-5717-4562-b3fc-2c963f66afa6",
"type": "MMS",
"messaging_profile_id": "4000eba1-a0c0-4563-9925-b25e842a7cb6",
"organization_id": "b448f9cc-a842-4784-98e9-03c1a5872950",
"from": {
"phone_number": "+18445550001",
"carrier": "TELNYX LLC",
"line_type": "VoIP"
},
"to": [
{
"phone_number": "+18665550001",
"status": "queued",
"carrier": "T-MOBILE USA, INC.",
"line_type": "Wireless"
}
],
"cc": [],
"text": "Hello, World!",
"subject": "From Telnyx!",
"media": [
{
"url": "https://pbs.twimg.com/profile_images/1142168442042118144/AW3F4fFD_400x400.png",
"content_type": null,
"sha256": null,
"size": null
}
],
"webhook_url": "https://www.example.com/hooks",
"webhook_failover_url": "https://backup.example.com/hooks",
"encoding": "GSM-7",
"parts": 1,
"tags": ["Greetings"],
"cost": { "amount": 0.0051, "currency": "USD" },
"cost_breakdown": {
"carrier_fee": { "amount": 0.00305, "currency": "USD" },
"rate": { "amount": 0.00205, "currency": "USD" }
},
"tcr_campaign_id": "TCPA3X7",
"tcr_campaign_billable": true,
"tcr_campaign_registered": "REGISTERED",
"received_at": "2019-01-23T18:10:02.574Z",
"sent_at": null,
"completed_at": null,
"valid_until": null,
"errors": []
}Was this page helpful?