Twilio SMS

Send and receive SMS messages through Twilio in Convex applications with built-in message status tracking and query support.

Installation

npm install @convex-dev/twilio

About Twilio SMS

Convex component for sending/receiving SMS messages with Twilio.

Benefits

Use cases

how to send SMS notifications from Convex mutations

Use the Convex Twilio component to send SMS messages directly from your mutations using the sendSMS action. The component handles Twilio API authentication and provides built-in error handling for message delivery.

track SMS delivery status in Convex database

The Twilio component automatically stores message status in your Convex database and provides query functions to check delivery status. You can track sent, delivered, failed, and undelivered message states without additional API calls.

receive SMS webhooks in Convex application

Configure Twilio webhooks to trigger Convex actions when SMS messages are received. The component provides type-safe webhook handlers that parse incoming message data and store it in your database.

build two-way SMS chat with Convex and Twilio

Combine the component's outbound SMS sending capabilities with inbound webhook handling to create bidirectional SMS conversations. Query functions let you retrieve message history and conversation state in real-time.

Frequently asked questions

How do I configure Twilio credentials for the Convex Twilio component?

Store your Twilio Account SID and Auth Token as environment variables in your Convex deployment. The Convex Twilio component automatically reads these credentials and handles authentication with the Twilio API for all SMS operations.

Can I query SMS message status without making additional API calls?

Yes, the Convex Twilio component stores message status in your Convex database and provides query functions to retrieve delivery status. This eliminates the need for additional Twilio API calls when checking message delivery status.

Does the component handle Twilio webhook verification?

The Convex Twilio component includes built-in webhook signature verification to ensure incoming SMS messages are actually from Twilio. This security feature validates webhook authenticity before processing incoming message data.

What happens if SMS sending fails with the Twilio component?

The Convex Twilio component provides structured error handling for failed SMS messages, including rate limiting, invalid numbers, and network errors. Failed messages are logged with error details in your Convex database for debugging and retry logic.

Links