# Twilio SMS & WhatsApp Sample

Demonstrates the Twilio connectors (`TwilioSmsConnector` and `TwilioWhatsAppConnector`): sending SMS and WhatsApp messages through the Twilio API, status callbacks, and webhook inbound processing.

## What it shows

* Building a `Message` for SMS or WhatsApp delivery
* Sending via `IMessagingClient` using the `sms` or `whatsapp` channel name
* Validating messages against the Twilio channel schema before sending
* Parsing inbound webhook payloads and delivery status callbacks
* Using Messaging Service SID for SMS sending
* Viewing channel schemas, capabilities, and parameters
* Checking connector runtime status

## Run

```bash
cd samples/twilio
./run.sh -- twilio <command>
```

## Root commands

| Command         | Description                                            |
| --------------- | ------------------------------------------------------ |
| `schema [name]` | Show the Twilio channel schema                         |
| `configure`     | Prompt for Account SID, Auth Token, and other settings |

## SMS subcommands

```bash
./run.sh -- twilio sms <command>
```

| Command                              | Description                        |
| ------------------------------------ | ---------------------------------- |
| `send`                               | Build and send a live SMS message  |
| `validate`                           | Validate a sample SMS message      |
| `status`                             | Show SMS connector runtime status  |
| `receive [-f file] [-m mode]`        | Parse a sample SMS webhook payload |
| `receive-status [-f file] [-m mode]` | Parse a sample SMS status callback |

## WhatsApp subcommands

```bash
./run.sh -- twilio whatsapp <command>
```

| Command                              | Description                                               |
| ------------------------------------ | --------------------------------------------------------- |
| `send`                               | Build and send a live WhatsApp message                    |
| `validate -k <kind>`                 | Validate a sample WhatsApp message (`text` or `template`) |
| `status`                             | Show WhatsApp connector runtime status                    |
| `receive [-f file] [-m mode]`        | Parse a sample WhatsApp webhook payload                   |
| `receive-status [-f file] [-m mode]` | Parse a sample WhatsApp status callback                   |

## Example

```bash
./run.sh -- twilio configure
./run.sh -- twilio sms send
```

You will be prompted to select the sender mode (From number or Messaging service), enter the recipient, and compose the message body.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ratatosk.deveel.org/samples/twilio.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
