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.sendWhatsapp({
from: '+13125551234',
to: '+13125551234',
whatsapp_message: {},
});
console.log(response.data);{
"data": {
"record_type": "message",
"direction": "outbound",
"id": "4031938e-60e4-4235-a8dd-0b1c55a23e7a",
"type": "WHATSAPP",
"organization_id": "9f61d8e1-7687-4d6d-9cae-9ff682985983",
"messaging_profile_id": "4001781e-626f-4a41-a914-b1b682150f94",
"from": {
"phone_number": "<string>",
"status": "received",
"carrier": "<string>",
"line_type": "Wireline"
},
"to": [
{
"phone_number": "+13125551234",
"status": "queued",
"carrier": "Verizon Wireless",
"line_type": "Wireless"
}
],
"body": {
"audio": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"document": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"image": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"sticker": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"video": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"interactive": {
"type": "cta_url",
"action": {
"name": "<string>",
"button": "<string>",
"buttons": [
{
"type": "reply",
"reply": {
"title": "<string>",
"id": "<string>"
}
}
],
"catalog_id": "<string>",
"product_retailer_id": "<string>",
"sections": [
{
"product_items": [
{
"product_retailer_id": "<string>"
}
],
"rows": [
{
"id": "<string>",
"title": "<string>",
"description": "<string>"
}
],
"title": "<string>"
}
],
"mode": "<string>",
"parameters": {
"display_text": "<string>",
"url": "<string>"
},
"cards": [
{
"card_index": 123,
"type": "cta_url",
"header": {
"type": "image",
"image": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"video": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
}
},
"body": {
"text": "<string>"
},
"action": {
"product_retailer_id": "<string>",
"catalog_id": "<string>"
}
}
]
},
"body": {
"text": "<string>"
},
"footer": {
"text": "<string>"
},
"header": {
"document": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"image": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"video": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"text": "<string>",
"sub_text": "<string>"
}
},
"location": {
"latitude": "<string>",
"longitude": "<string>",
"name": "<string>",
"address": "<string>"
},
"contacts": [
{
"addresses": [
{
"street": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country": "<string>",
"country_code": "<string>",
"type": "<string>"
}
],
"birthday": "<string>",
"emails": [
{
"email": "<string>",
"type": "<string>"
}
],
"name": "<string>",
"org": {
"company": "<string>",
"department": "<string>",
"title": "<string>"
},
"phones": [
{
"phone": "<string>",
"type": "<string>",
"wa_id": "<string>"
}
],
"urls": [
{
"url": "<string>",
"type": "<string>"
}
]
}
],
"reaction": {
"message_id": "<string>",
"emoji": "<string>"
},
"biz_opaque_callback_data": "<string>",
"type": "audio"
},
"encoding": "utf-8",
"received_at": "2023-11-07T05:31:56Z",
"wait_seconds": 0.5
}
}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.sendWhatsapp({
from: '+13125551234',
to: '+13125551234',
whatsapp_message: {},
});
console.log(response.data);{
"data": {
"record_type": "message",
"direction": "outbound",
"id": "4031938e-60e4-4235-a8dd-0b1c55a23e7a",
"type": "WHATSAPP",
"organization_id": "9f61d8e1-7687-4d6d-9cae-9ff682985983",
"messaging_profile_id": "4001781e-626f-4a41-a914-b1b682150f94",
"from": {
"phone_number": "<string>",
"status": "received",
"carrier": "<string>",
"line_type": "Wireline"
},
"to": [
{
"phone_number": "+13125551234",
"status": "queued",
"carrier": "Verizon Wireless",
"line_type": "Wireless"
}
],
"body": {
"audio": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"document": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"image": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"sticker": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"video": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"interactive": {
"type": "cta_url",
"action": {
"name": "<string>",
"button": "<string>",
"buttons": [
{
"type": "reply",
"reply": {
"title": "<string>",
"id": "<string>"
}
}
],
"catalog_id": "<string>",
"product_retailer_id": "<string>",
"sections": [
{
"product_items": [
{
"product_retailer_id": "<string>"
}
],
"rows": [
{
"id": "<string>",
"title": "<string>",
"description": "<string>"
}
],
"title": "<string>"
}
],
"mode": "<string>",
"parameters": {
"display_text": "<string>",
"url": "<string>"
},
"cards": [
{
"card_index": 123,
"type": "cta_url",
"header": {
"type": "image",
"image": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"video": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
}
},
"body": {
"text": "<string>"
},
"action": {
"product_retailer_id": "<string>",
"catalog_id": "<string>"
}
}
]
},
"body": {
"text": "<string>"
},
"footer": {
"text": "<string>"
},
"header": {
"document": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"image": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"video": {
"link": "http://example.com/media.jpg",
"caption": "<string>",
"filename": "<string>",
"voice": true
},
"text": "<string>",
"sub_text": "<string>"
}
},
"location": {
"latitude": "<string>",
"longitude": "<string>",
"name": "<string>",
"address": "<string>"
},
"contacts": [
{
"addresses": [
{
"street": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country": "<string>",
"country_code": "<string>",
"type": "<string>"
}
],
"birthday": "<string>",
"emails": [
{
"email": "<string>",
"type": "<string>"
}
],
"name": "<string>",
"org": {
"company": "<string>",
"department": "<string>",
"title": "<string>"
},
"phones": [
{
"phone": "<string>",
"type": "<string>",
"wa_id": "<string>"
}
],
"urls": [
{
"url": "<string>",
"type": "<string>"
}
]
}
],
"reaction": {
"message_id": "<string>",
"emoji": "<string>"
},
"biz_opaque_callback_data": "<string>",
"type": "audio"
},
"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.
Whatsapp message body
Phone number in +E.164 format associated with Whatsapp account
"+13125551234"
Phone number in +E.164 format
"+13125551234"
Show child attributes
Message type - must be set to "WHATSAPP"
WHATSAPP "WHATSAPP"
The URL where webhooks related to this message will be sent.
Successful operation
Show child attributes
Was this page helpful?