본문으로 건너뛰기
cccskills
무료GitHub에 공개

telnyx-whatsapp-curl

Send WhatsApp messages, manage templates, WABAs, and phone numbers via the Telnyx WhatsApp Business API.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구X (Twitter)
설치 방법 보기

포함된 파일(2)

  • SKILL.md15.5 KB
  • references/api-details.md6.7 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Telnyx WhatsApp Business API - curl

Installation

# curl is pre-installed on macOS, Linux, and Windows 10+

Setup

export TELNYX_API_KEY="YOUR_API_KEY_HERE"

All examples below use $TELNYX_API_KEY for authentication.

Error Handling

All API calls can fail with network errors, rate limits (429), validation errors (422), or authentication errors (401). Always handle errors in production code:

curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "from": "+19452940762",
      "to": "+18005551234",
      "type": "WHATSAPP",
      "whatsapp_message": {
        "type": "text",
        "text": { "body": "Hello from Telnyx!" }
      }
  }' \
  "https://api.telnyx.com/v2/messages/whatsapp"

Common error codes: 401 invalid API key, 403 insufficient permissions, 404 resource not found, 422 validation error (check field formats), 429 rate limited (retry with exponential backoff).

WhatsApp-Specific Errors

  • 40008 — Meta catch-all error. Check template parameters, phone number formatting, and 24-hour window rules.
  • 131047 — Message failed to send during the 24-hour window. The customer hasn't messaged you first (for non-template messages).
  • 131026 — Recipient phone number is not a WhatsApp user.
  • 132000 — Template parameter count mismatch. Ensure the number of parameters matches the template definition.
  • 132015 — Template paused or disabled by Meta due to quality issues.

Important Notes

  • Phone numbers must be in E.164 format (e.g., +13125550001). Include the + prefix and country code.
  • Template messages can be sent anytime. Free-form (session) messages can only be sent within a 24-hour window after the customer last messaged you.
  • Template IDs: You can reference templates by Telnyx UUID (template_id) instead of name + language. When template_id is provided, name and language are resolved automatically.
  • Billing types: Template messages are billed as whatsapp_marketing, whatsapp_utility, whatsapp_authentication, or whatsapp_authentication_international based on category and destination.

Operational Caveats

  • The sending phone number must be registered with a WhatsApp Business Account (WABA) and associated with a messaging profile.
  • Templates must be in APPROVED status before they can be used for sending.
  • Template names must be lowercase with underscores only (e.g., order_confirmation). No spaces, hyphens, or uppercase.
  • When creating templates, provide realistic sample values for body parameters — Meta reviewers check these during approval.
  • Category selection matters for billing: AUTHENTICATION templates get special pricing but must contain an OTP. UTILITY is for transactional messages. MARKETING for promotional content.
  • Meta may reclassify your template category (e.g., UTILITY to MARKETING) which affects billing.

Reference Use Rules

Do not invent Telnyx parameters, enums, response fields, or webhook fields.

Core Tasks

Send a WhatsApp template message

Send a pre-approved template message. Templates can be sent anytime — no 24-hour window restriction.

POST /messages/whatsapp

ParameterTypeRequiredDescription
fromstring (E.164)YesWhatsApp-enabled phone number in +E.164 format
tostring (E.164)YesRecipient phone number in +E.164 format
typestringNoMust be WHATSAPP
whatsapp_message.typestringYesMust be template
whatsapp_message.template.namestringYes*Template name (e.g., order_confirmation)
whatsapp_message.template.language.codestringYes*Language code (e.g., en_US)
whatsapp_message.template.template_idstring (UUID)NoTelnyx template UUID. If provided, name and language are resolved from DB
whatsapp_message.template.componentsarrayNoTemplate parameter values
messaging_profile_idstring (UUID)NoMessaging profile to use
webhook_urlstring (URL)NoCallback URL for delivery status updates

*Required unless template_id is provided.

# Send by template name + language
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "from": "+19452940762",
      "to": "+18005551234",
      "type": "WHATSAPP",
      "whatsapp_message": {
        "type": "template",
        "template": {
          "name": "order_confirmation",
          "language": { "code": "en_US" },
          "components": [
            {
              "type": "body",
              "parameters": [
                { "type": "text", "text": "ORD-12345" },
                { "type": "text", "text": "March 15, 2026" }
              ]
            }
          ]
        }
      }
  }' \
  "https://api.telnyx.com/v2/messages/whatsapp"
# Send by Telnyx template_id (no name/language needed)
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "from": "+19452940762",
      "to": "+18005551234",
      "type": "WHATSAPP",
      "whatsapp_message": {
        "type": "template",
        "template": {
          "template_id": "019cd44b-3a1c-781b-956e-bd33e9fd2ac6",
          "components": [
            {
              "type": "body",
              "parameters": [
                { "type": "text", "text": "483291" }
              ]
            }
          ]
        }
      }
  }' \
  "https://api.telnyx.com/v2/messages/whatsapp"

Primary response fields:

  • .data.id — Message UUID
  • .data.to[0].status — queued, sent, delivered, failed
  • .data.from.phone_number
  • .data.type — WHATSAPP

Send a free-form WhatsApp text message

Send a text message within the 24-hour customer service window (customer must have messaged you first).

POST /messages/whatsapp

ParameterTypeRequiredDescription
fromstring (E.164)YesWhatsApp-enabled phone number
tostring (E.164)YesRecipient phone number
whatsapp_message.typestringYestext
whatsapp_message.text.bodystringYesMessage content
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "from": "+19452940762",
      "to": "+18005551234",
      "type": "WHATSAPP",
      "whatsapp_message": {
        "type": "text",
        "text": { "body": "Your order has shipped!" }
      }
  }' \
  "https://api.telnyx.com/v2/messages/whatsapp"

List WhatsApp Business Accounts

Retrieve all WABAs associated with your Telnyx account.

GET /v2/whatsapp/business_accounts

ParameterTypeRequiredDescription
page[number]integerNoPage number (default: 1)
page[size]integerNoPage size (default: 20)
curl \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  "https://api.telnyx.com/v2/whatsapp/business_accounts"

Primary response fields:

  • .data[].id — Telnyx WABA UUID
  • .data[].waba_id — Meta WABA ID
  • .data[].name — Business name
  • .data[].status — Account status
  • .data[].country — WABA country

List templates

Retrieve message templates, optionally filtered by WABA.

GET /v2/whatsapp/message_templates

ParameterTypeRequiredDescription
waba_idstring (UUID)NoFilter by Telnyx WABA UUID (query parameter)
categorystringNoFilter by category: AUTHENTICATION, MARKETING, UTILITY
statusstringNoFilter by status: APPROVED, PENDING, REJECTED, DISABLED
page[number]integerNoPage number
page[size]integerNoPage size
curl \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  "https://api.telnyx.com/v2/whatsapp/message_templates?waba_id=019c1ff0-5c30-7f36-8436-730b1d0b0e56&status=APPROVED"

Primary response fields:

  • .data[].id — Telnyx template UUID (use this as template_id when sending)
  • .data[].name — Template name
  • .data[].category — AUTHENTICATION, MARKETING, or UTILITY
  • .data[].language — Language code (e.g., en_US)
  • .data[].status — APPROVED, PENDING, REJECTED, DISABLED
  • .data[].components — Template components (header, body, footer, buttons)

Create a message template

Submit a new template for Meta review. Templates typically take minutes to hours for approval.

POST /v2/whatsapp/message_templates

ParameterTypeRequiredDescription
waba_idstring (UUID)YesTelnyx WABA UUID (body parameter)
namestringYesLowercase with underscores only (e.g., order_update)
categorystringYesAUTHENTICATION, MARKETING, or UTILITY
languagestringYesLanguage code (e.g., en_US)
componentsarrayYesTemplate components
curl \
  -X POST \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "waba_id": "019c1ff0-5c30-7f36-8436-730b1d0b0e56",
      "name": "order_shipped",
      "category": "UTILITY",
      "language": "en_US",
      "components": [
        {
          "type": "BODY",
          "text": "Your order {{1}} has been shipped and will arrive by {{2}}.",
          "example": {
            "body_text": [["ORD-12345", "March 20, 2026"]]
          }
        }
      ]
  }' \
  "https://api.telnyx.com/v2/whatsapp/message_templates"

Primary response fields:

  • .data.id — Telnyx template UUID
  • .data.name — Template name
  • .data.status — Initially PENDING until Meta approves

List phone numbers

GET /v2/whatsapp/phone_numbers

ParameterTypeRequiredDescription
waba_idstring (UUID)NoFilter by Telnyx WABA UUID (query parameter)
curl \
  -H "Authorization: Bearer $TELNYX_API_KEY" \
  "https://api.telnyx.com/v2/whatsapp/phone_numbers?waba_id=019c1ff0-5c30-7f36-8436-730b1d0b0e56"

Primary response fields:

  • .data[].phone_number — Phone number in E.164 format
  • .data[].number_id — Meta phone number ID
  • .data[].quality_rating — GREEN, YELLOW, or RED
  • .data[].messaging_limit_tier — Current messaging tier

Webhook Verification

Telnyx signs webhooks with Ed25519. Each request includes telnyx-signature-ed25519 and telnyx-timestamp headers. Always verify signatures in production.

Webhooks

These webhook payload fields are inline because they are part of the primary integration path.

Message Delivery Update

FieldTypeDescription
data.event_typeenum: message.sent, message.finalizedDelivery status event
data.payload.iduuidMessage ID
data.payload.to[0].statusstringqueued, sent, delivered, read, failed
data.payload.template_idstringTelnyx template UUID (if template message)
data.payload.template_namestringTemplate name (if template message)
data.payload.costobjectCost information
data.payload.errorsarrayError details if failed

Template Status Change

Configure webhook events on your WABA to receive template lifecycle notifications.

FieldTypeDescription
event_typestringwhatsapp.template.approved, whatsapp.template.rejected, whatsapp.template.disabled
payload.template_idstringTelnyx template UUID
payload.template_namestringTemplate name
payload.statusstringNew template status
payload.reasonstringRejection/disable reason (if applicable)
payload.waba_idstringWABA ID

Phone Number Quality Change

FieldTypeDescription
event_typestringwhatsapp.phone_number.quality_changed
payload.phone_numberstringPhone number in E.164 format
payload.previous_quality_ratingstringPrevious rating (GREEN, YELLOW, RED)
payload.new_quality_ratingstringNew rating

Template Best Practices

  • Naming: Use lowercase with underscores. Be descriptive (e.g., appointment_reminder, not msg1).
  • Sample values: Provide realistic examples in the example field — Meta reviewers check these.
  • Category selection:
    • AUTHENTICATION — OTP/verification codes only. Gets special pricing.
    • UTILITY — Transactional (order updates, shipping, account alerts).
    • MARKETING — Promotional content, offers, newsletters.
  • Keep it concise: Meta prefers shorter templates. Avoid unnecessary formatting.
  • Avoid prohibited content: No misleading claims, prohibited products, or URL shorteners in template body.
  • Parameters: Use {{1}}, {{2}}, etc. for variable content. Always provide the correct number of parameters when sending.

Important Supporting Operations

OperationEndpointUse Case
Get template detailsGET /v2/whatsapp_message_templates/{id}Check template status, view components
Get business profileGET /v2/whatsapp/phone_numbers/{phone_number}/profileView business display name, photo, description
Configure WABA settingsPATCH /v2/whatsapp/business_accounts/{id}/settingsSubscribe to template/account events

Additional Operations

OperationMethodEndpointUse CaseRequired Params
Send WhatsApp messagePOST/messages/whatsappSend template or free-form messagefrom, to, whatsapp_message
List WABAsGET/v2/whatsapp/business_accountsList all business accounts—
Get WABAGET/v2/whatsapp/business_accounts/{id}Get WABA detailsid
List templatesGET/v2/whatsapp/message_templatesList templates with filtering—
Get templateGET/v2/whatsapp_message_templates/{id}Get template detailsid
Create templatePOST/v2/whatsapp/message_templatesCreate new templatewaba_id, name, category, language, components
List phone numbersGET/v2/whatsapp/phone_numbersList WABA phone numbers—
Get business profileGET/v2/whatsapp/phone_numbers/{phone_number}/profileView profile infophone_number
Update business profilePATCH/v2/whatsapp/phone_numbers/{phone_number}/profileUpdate profile infophone_number
Get WABA settingsGET/v2/whatsapp/business_accounts/{id}/settingsView WABA settings/webhook configid
Update WABA settingsPATCH/v2/whatsapp/business_accounts/{id}/settingsSet webhook URL and eventsid

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Test VoIP push notifications for Telnyx WebRTC iOS (APNs) and Android (FCM) apps. Use when debugging push notification delivery, validating certificate/credential setup, or testing that a device receives VoIP pushes correctly.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

team-telnyx/ai2242026년 10월 23일 업데이트

10DLC brand and campaign registration for US A2P messaging compliance. Assign phone numbers to campaigns.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

team-telnyx/ai2242026년 10월 23일 업데이트

10DLC brand and campaign registration for US A2P messaging compliance. Assign phone numbers to campaigns.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

team-telnyx/ai2242026년 10월 23일 업데이트

10DLC brand and campaign registration for US A2P messaging compliance. Assign phone numbers to campaigns.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

team-telnyx/ai2242026년 10월 23일 업데이트

10DLC brand and campaign registration for US A2P messaging compliance. Assign phone numbers to campaigns.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

team-telnyx/ai2242026년 10월 23일 업데이트

10DLC brand and campaign registration for US A2P messaging compliance. Assign phone numbers to campaigns.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

team-telnyx/ai2242026년 10월 23일 업데이트

team-telnyx의 스킬 모두 보기

이 스킬의 문제 신고