Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
twilio avatar

Twilio Whatsapp Send Message

  • 92 installs
  • 26 repo stars
  • Updated July 29, 2026
  • twilio/ai

How to send WhatsApp messages via Twilio with correct service window handling, template approval, and production sender setup.

About

Twilio WhatsApp messaging enables developers to send messages through the Programmable Messaging API using two modes: free-form (within 24 hours of inbound contact) and template-based (anytime). This skill covers sandbox setup, template approval workflows, production sender registration, service window constraints, media handling (max 16 MB), and WhatsApp-specific error codes. Developers learn prerequisite credential setup, E.164 number formatting with whatsapp: prefix, content template creation via Meta approval, and handling delivery failures outside the service window. Common errors include invalid destination numbers, rate limits (80 MPS default), and missing business opt-in consent.

  • Two-mode sending: free-form (24-hr window) and template (anytime)
  • E.164 whatsapp: number prefix required for all recipients
  • Max 16 MB media; templates require Meta approval via Content Template Builder
  • Sandbox testing at +14155238886; production requires WhatsApp Business Account
  • Error handling for service window violations, rate limits, and opt-in violations

Twilio Whatsapp Send Message by the numbers

  • 92 all-time installs (skills.sh)
  • +6 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #3,014 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/twilio/ai --skill twilio-whatsapp-send-message

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs92
repo stars26
Last updatedJuly 29, 2026
Repositorytwilio/ai

What it does

Send WhatsApp messages via Twilio with 24-hour service window rules and template-based delivery.

Who is it for?

Building chatbots, notification systems, and customer engagement on WhatsApp; backend teams integrating Twilio's Programmable Messaging.

Skip if: WhatsApp Groups API (deprecated 2020); batch SMS campaigns; building WhatsApp clients from scratch.

When should I use this skill?

Setting up WhatsApp for first time; debugging delivery failures; implementing template-based messaging; configuring production WhatsApp Business Account.

What you get

Developers successfully send messages within service windows, use templates for out-of-window delivery, and debug WhatsApp-specific failures.

Files

SKILL.mdMarkdownGitHub ↗

Overview

WhatsApp is one channel in Twilio's Messaging platform. All channels share the same messages.create() API — see twilio-messaging-overview for the full channel comparison and onboarding sequence.

Twilio routes WhatsApp through the Programmable Messaging API — all numbers use whatsapp:+E.164 prefix. Two sending modes apply: free-form (within 24 hrs of last inbound) and template (anytime). Sending free-form outside the window causes silent delivery failure — always check which mode is required.

ModeWhen allowedParameters
Free-formWithin 24 hrs of last inbound from userbody, optional mediaUrl
TemplateAnytimecontentSid + contentVariables

---

Prerequisites

  • Twilio account with WhatsApp enabled

— New to Twilio? See twilio-account-setup

  • Environment variables:
  • TWILIO_ACCOUNT_SID
  • TWILIO_AUTH_TOKEN

— See twilio-iam-auth-setup for credential setup and best practices

  • SDK: pip install twilio / npm install twilio
  • Recipient opted in to receive messages from your WhatsApp Business Account

Testing (sandbox): Join by texting join <your-code> to +14155238886. No registration needed — see Console > Messaging > Try it out > Send a WhatsApp message. Sandbox participants must re-join every 3 days.

Production: Register a WhatsApp Business sender first — see twilio-whatsapp-manage-senders.

---

Quickstart

Python

import os
from twilio.rest import Client

client = Client(os.environ["TWILIO_ACCOUNT_SID"], os.environ["TWILIO_AUTH_TOKEN"])

message = client.messages.create(
    from_="whatsapp:+14155238886",   # Sandbox sender (or your production number)
    to="whatsapp:+15005550006",      # Must have joined the sandbox
    body="Your order has been confirmed."
)

print(message.sid)     # MMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
print(message.status)  # queued | sent | delivered | failed

Node.js

const twilio = require("twilio");
const client = twilio(process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN);

const message = await client.messages.create({
    from: "whatsapp:+14155238886",
    to: "whatsapp:+15005550006",
    body: "Your order has been confirmed.",
});

console.log(message.sid);
console.log(message.status);

---

Key Patterns

Send a Template Message (outside service window)

Templates are created in Console > Messaging > Content Template Builder and must be approved by Meta. See twilio-content-template-builder for template creation.

Python

message = client.messages.create(
    from_="whatsapp:+14155238886",
    to="whatsapp:+15005550006",
    content_sid="HXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    content_variables='{"1": "March 25", "2": "2:00 PM"}'
)

Node.js

const message = await client.messages.create({
    from: "whatsapp:+14155238886",
    to: "whatsapp:+15005550006",
    contentSid: "HXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    contentVariables: JSON.stringify({ "1": "March 25", "2": "2:00 PM" }),
});

Send Media (free-form only)

Max file size: 16 MB.

Python

message = client.messages.create(
    from_="whatsapp:+14155238886",
    to="whatsapp:+15005550006",
    body="Here is your invoice.",
    media_url=["https://example.com/invoice.pdf"]
)

Node.js

const message = await client.messages.create({
    from: "whatsapp:+14155238886",
    to: "whatsapp:+15005550006",
    body: "Here is your invoice.",
    mediaUrl: ["https://example.com/invoice.pdf"],
});

---

Response Fields

FieldDescription
sidUnique message identifier (MM...)
statusqueued, sent, delivered, read, failed, undelivered
error_codePopulated on failure
error_messageHuman-readable error description
date_sentUTC timestamp

---

Common Errors

CodeMeaningFix
63003Invalid WhatsApp destination numberVerify number is WhatsApp-enabled and correctly formatted
63018Rate limit exceeded on senderReduce send rate; default is 80 MPS
63020Business hasn't accepted Twilio's Meta invitationAccept invite in Meta Business Manager
N/AFree-form outside windowSwitch to a template message

---

CANNOT

  • Cannot exceed 80 messages/second per sender — Text-only can be raised to 400 MPS on request
  • Cannot queue messages beyond 4 hours — Undelivered messages fail after 4 hours
  • Cannot exceed sandbox throttle limits — 1 message per 3 seconds, 50 messages/day on trial, participants expire after 3 days
  • Cannot send without opt-in — Sending without recipient opt-in risks account suspension
  • Cannot use WhatsApp Groups API — Deprecated April 2020. Use Conversations API instead.

---

Next Steps

  • Channel overview and onboarding guide: twilio-messaging-overview
  • Register a production WhatsApp sender: twilio-whatsapp-manage-senders
  • Create and manage message templates: twilio-content-template-builder
  • Multi-channel conversations with history: twilio-conversations-api

Related skills

Backend & APIsbackendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.