Labsco
openai logo

twilio-content-template-builder

✓ Official4,081

by openai · part of openai/plugins

Create, manage, and send message templates using Twilio's Content API. Covers template creation for WhatsApp, SMS, RCS, and MMS; variable usage; WhatsApp Meta approval; and sending templates via ContentSid. Use this skill when building structured messages that require pre-approval or consistent formatting across channels.

🧩 One of 7 skills in the openai/plugins package — works on its own, and pairs well with its siblings.

This is the playbook your agent receives when the skill activates — you don't need to read it to use the skill, but it's here to audit before installing.

Overview

The Content API creates channel-agnostic templates identified by a ContentSid (HX...). WhatsApp templates must be approved by Meta before use outside the 24-hour service window.


Key Patterns

Create a Template via API

Python

template = client.content.v1.contents.create(
    friendly_name="appointment-reminder",
    language="en",
    types={
        "twilio/text": {
            "body": "Hi {{1}}, your appointment is on {{2}} at {{3}}. Reply YES to confirm."
        }
    }
)
print(template.sid)  # HXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Node.js

const template = await client.content.v1.contents.create({
    friendlyName: "appointment-reminder",
    language: "en",
    types: {
        "twilio/text": {
            body: "Hi {{1}}, your appointment is on {{2}} at {{3}}. Reply YES to confirm.",
        },
    },
});
console.log(template.sid);

Submit for WhatsApp Approval

Python

approval = client.content.v1 \
    .contents(template.sid) \
    .approval_requests \
    .create(name="appointment-reminder", category="UTILITY")
print(approval.status)  # PENDING

Node.js

const approval = await client.content.v1
    .contents(templateSid)
    .approvalRequests.create({ name: "appointment-reminder", category: "UTILITY" });
console.log(approval.status);

Categories: UTILITY, MARKETING, AUTHENTICATION

Check Approval Status

Python

content = client.content.v1.contents(template.sid).fetch()
print(content.approval_requests.status)  # APPROVED | REJECTED | PENDING

Node.js

const content = await client.content.v1.contents(templateSid).fetch();
console.log(content.approvalRequests.status);

Approval typically takes under 1 hour.

List and Delete Templates

Python

for template in client.content.v1.contents.list():
    print(template.sid, template.friendly_name, template.language)

client.content.v1.contents("HXxxxxxxxxxx").delete()

Node.js

const templates = await client.content.v1.contents.list();
templates.forEach(t => console.log(t.sid, t.friendlyName, t.language));

await client.content.v1.contents("HXxxxxxxxxxx").remove();

Supported Content Types

Typetypes keyChannels
Plain texttwilio/textAll
Media (image, video)twilio/mediaWhatsApp, MMS, RCS
Quick reply buttonstwilio/quick-replyWhatsApp, RCS
Call-to-action buttonstwilio/call-to-actionWhatsApp, RCS
List pickertwilio/list-pickerWhatsApp
Cardtwilio/cardRCS
Carouseltwilio/carouselRCS

RCS Fallback Text

When sending a rich RCS template (card, carousel, quick reply) via a Messaging Service with SMS fallback configured, Twilio uses the template's twilio/text body as the SMS fallback copy. Any template intended for RCS should include a twilio/text entry so recipients on non-RCS devices still receive a readable message.


Variable Rules

  • Use {{1}}, {{2}} — sequential, no skipping
  • Max 100 variables per template
  • Provide sample values for WhatsApp submissions
  • Non-variable to variable ratio must be at least (2x + 1) : x

CANNOT

  • Cannot use WhatsApp templates without Meta approval — Plan for up to 24 hours review time
  • Cannot resubmit a rejected template with the same name — Use a different name for resubmission
  • Cannot include custom variables in AUTHENTICATION templates — Fixed format required by Meta

Next Steps

  • Channel overview and onboarding guide: twilio-messaging-overview
  • Send WhatsApp messages: twilio-whatsapp-send-message
  • Register a production WhatsApp sender: twilio-whatsapp-manage-senders