@matimo/twilio 0.1.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +451 -0
- package/assets/twilio-icon.svg +1 -0
- package/definition.yaml +42 -0
- package/package.json +19 -0
- package/tools/twilio-get-message/definition.yaml +133 -0
- package/tools/twilio-list-messages/definition.yaml +133 -0
- package/tools/twilio-send-mms/definition.yaml +162 -0
- package/tools/twilio-send-sms/definition.yaml +155 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tallclub
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
# @matimo/twilio — Twilio Messaging Tools for Matimo
|
|
2
|
+
|
|
3
|
+
Twilio Programmable Messaging integration tools for Matimo's universal AI tools ecosystem. Send SMS and MMS messages, and manage message resources through YAML-defined tools that work with any AI framework.
|
|
4
|
+
|
|
5
|
+
## 📦 Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @matimo/twilio
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @matimo/twilio
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 🛠️ Available Tools (4 Total)
|
|
14
|
+
|
|
15
|
+
| Category | Tool | Method | Description |
|
|
16
|
+
|----------|------|--------|-------------|
|
|
17
|
+
| **Messaging** | `twilio-send-sms` | POST | Send an outbound SMS message |
|
|
18
|
+
| **Messaging** | `twilio-send-mms` | POST | Send an outbound MMS message with media |
|
|
19
|
+
| **Messages** | `twilio-get-message` | GET | Fetch a single message by SID |
|
|
20
|
+
| **Messages** | `twilio-list-messages` | GET | List messages with optional filters |
|
|
21
|
+
|
|
22
|
+
## 🚀 Quick Start
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { MatimoInstance } from 'matimo';
|
|
26
|
+
|
|
27
|
+
const matimo = await MatimoInstance.init({ autoDiscover: true });
|
|
28
|
+
|
|
29
|
+
// Send an SMS
|
|
30
|
+
const result = await matimo.execute('twilio-send-sms', {
|
|
31
|
+
account_sid: process.env.TWILIO_ACCOUNT_SID,
|
|
32
|
+
to: '+15558675310',
|
|
33
|
+
from: '+15557122661',
|
|
34
|
+
body: 'Hello from Matimo!',
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// List recent messages
|
|
38
|
+
const messages = await matimo.execute('twilio-list-messages', {
|
|
39
|
+
account_sid: process.env.TWILIO_ACCOUNT_SID,
|
|
40
|
+
page_size: 10,
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 🔐 Account Setup & Authentication
|
|
45
|
+
|
|
46
|
+
Twilio uses **HTTP Basic authentication** (`Account SID` as the username and `Auth Token` as the password). Matimo handles the encoding automatically — you only need to set two environment variables.
|
|
47
|
+
|
|
48
|
+
### Step 1: Create a Twilio Account
|
|
49
|
+
|
|
50
|
+
If you don't have one yet, sign up at [https://www.twilio.com/try-twilio](https://www.twilio.com/try-twilio). No credit card is required for a free trial account.
|
|
51
|
+
|
|
52
|
+
During sign-up you will:
|
|
53
|
+
1. Verify your **email address**
|
|
54
|
+
2. Verify your **personal phone number** (this becomes a Verified Caller ID automatically)
|
|
55
|
+
3. Customize your account by providing information about your project
|
|
56
|
+
|
|
57
|
+
After signing up you land in the [Twilio Console](https://console.twilio.com) where you can manage credentials, phone numbers, and usage.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### Step 2: Find Your Account SID and Auth Token
|
|
62
|
+
|
|
63
|
+
Your **Account SID** and **Auth Token** are displayed on your [Twilio Console dashboard](https://console.twilio.com) under **Account Info**.
|
|
64
|
+
|
|
65
|
+
- **Account SID** — a 34-character identifier that starts with `AC` (e.g. `ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`). Acts as your username for every API call.
|
|
66
|
+
- **Auth Token** — a 32-character secret key. Acts as your password. Click the **eye (👁) icon** to reveal it.
|
|
67
|
+
|
|
68
|
+
> ⚠️ **Security Note**: Keep both values secret. Do not commit them to version control. Anyone with your Account SID and Auth Token has full access to your Twilio project. Source: [Twilio Help — What is a Twilio Account SID?](https://help.twilio.com/articles/14726256820123-What-is-a-Twilio-Account-SID)
|
|
69
|
+
|
|
70
|
+
You can also find your Account SID in:
|
|
71
|
+
- The [API Keys & Tokens](https://console.twilio.com/us1/account/keys-credentials/api-keys) page
|
|
72
|
+
- Twilio communications emails sent to your registered address
|
|
73
|
+
- Your Twilio invoices
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### Step 3: Get a Twilio Phone Number
|
|
78
|
+
|
|
79
|
+
You need a **Twilio phone number** to use as the sender (`from` parameter). Trial accounts include one free phone number.
|
|
80
|
+
|
|
81
|
+
**To get your first number:**
|
|
82
|
+
1. Open the [Twilio Console](https://console.twilio.com) and click **Get phone number** on the home page, or go to [Buy a Number](https://console.twilio.com/us1/develop/phone-numbers/manage/search)
|
|
83
|
+
2. Set the search filters — **Country**, **Capabilities** (SMS / MMS / Voice), and **Number Type** (local, mobile, or toll-free)
|
|
84
|
+
3. Click **Buy** to provision the number to your account
|
|
85
|
+
|
|
86
|
+
> **Trial accounts**: You can have only **one Twilio phone number** at a time on a trial account, with a maximum of 3 unique numbers over the lifetime of the trial. [Upgrade your account](https://help.twilio.com/articles/223183208-Upgrading-to-a-paid-Twilio-Account) to provision additional numbers.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### Step 4: Set Environment Variables
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# .env — only two Twilio credentials needed
|
|
94
|
+
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
95
|
+
TWILIO_AUTH_TOKEN=your_32_char_auth_token_here
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
> **Zero extra steps!** Matimo natively handles HTTP Basic Auth — it reads `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN`, encodes them as `base64(AccountSid:AuthToken)`, and injects `Authorization: Basic ...` automatically on every request. No manual encoding required.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### Step 5: Required `account_sid` Parameter
|
|
103
|
+
|
|
104
|
+
Every Twilio tool requires your **Account SID** as the `account_sid` parameter. Twilio uses it in the API URL path (`/2010-04-01/Accounts/{AccountSid}/Messages.json`):
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
await matimo.execute('twilio-send-sms', {
|
|
108
|
+
account_sid: process.env.TWILIO_ACCOUNT_SID, // ← required for URL path on every call
|
|
109
|
+
to: '+15558675310',
|
|
110
|
+
from: '+15557122661',
|
|
111
|
+
body: 'Hello!',
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 📞 Phone Number Format (E.164)
|
|
118
|
+
|
|
119
|
+
All phone numbers must be in **E.164 format**: the `+` sign followed by the country code and number, with no spaces, dashes, or parentheses.
|
|
120
|
+
|
|
121
|
+
| Country | Local Format | E.164 Format |
|
|
122
|
+
|---------|-------------|--------------|
|
|
123
|
+
| United States | (555) 867-5309 | `+15558675309` |
|
|
124
|
+
| United Kingdom | 07700 900123 | `+447700900123` |
|
|
125
|
+
| India | 98765 43210 | `+919876543210` |
|
|
126
|
+
| Germany | 030 12345678 | `+493012345678` |
|
|
127
|
+
|
|
128
|
+
Reference: [What is E.164?](https://www.twilio.com/docs/glossary/what-e164)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 🧪 Trial Account Limitations
|
|
133
|
+
|
|
134
|
+
Twilio trial accounts include a small pre-loaded balance and some important restrictions. Source: [Twilio Free Trial Limitations](https://help.twilio.com/articles/360036052753-Twilio-Free-Trial-Limitations)
|
|
135
|
+
|
|
136
|
+
| Limitation | Details |
|
|
137
|
+
|-----------|---------|
|
|
138
|
+
| **Recipient verification** | You can only send messages to [Verified Caller IDs](https://console.twilio.com/us1/develop/phone-numbers/manage/verified). Sending to an unverified number returns error `21659`. |
|
|
139
|
+
| **Trial message prefix** | All outbound messages begin with _"Sent from a Twilio trial account"_. This is removed once you upgrade. |
|
|
140
|
+
| **Daily message limit** | Maximum **50 messages per day**. Exceeding this returns error `63038`. |
|
|
141
|
+
| **One phone number** | Only one Twilio phone number per trial account (up to 3 total over the account lifetime). |
|
|
142
|
+
| **No alphanumeric sender IDs** | Alphanumeric Sender IDs are not supported on trial accounts. |
|
|
143
|
+
| **No short codes** | Short codes are not available on trial accounts. |
|
|
144
|
+
| **US Twilio Region only** | Trial accounts are restricted to the US1 Twilio region. |
|
|
145
|
+
| **No WhatsApp** | WhatsApp Business API onboarding requires a paid account. |
|
|
146
|
+
| **International messaging** | Verify the recipient number AND enable the target country in [Messaging Geographic Permissions](https://console.twilio.com/us1/develop/sms/settings/geo-permissions). |
|
|
147
|
+
|
|
148
|
+
> To remove all trial restrictions, [upgrade to a paid Twilio account](https://help.twilio.com/articles/223183208-Upgrading-to-a-paid-Twilio-Account).
|
|
149
|
+
|
|
150
|
+
### How to Verify a Recipient Phone Number (Trial Accounts Only)
|
|
151
|
+
|
|
152
|
+
During trial, you can only send to numbers you have explicitly verified. To add a Verified Caller ID:
|
|
153
|
+
|
|
154
|
+
1. Go to [Verified Caller IDs](https://console.twilio.com/us1/develop/phone-numbers/manage/verified) in the Console
|
|
155
|
+
2. Click **Add a new Caller ID**
|
|
156
|
+
3. Enter the phone number in E.164 format (e.g. `+15558675310`)
|
|
157
|
+
4. Select **SMS** as the verification method — trial accounts **cannot** verify numbers by voice call
|
|
158
|
+
5. Enter the verification code sent to that number
|
|
159
|
+
|
|
160
|
+
The phone number you verified during sign-up is automatically included.
|
|
161
|
+
|
|
162
|
+
## 📚 Integration Examples
|
|
163
|
+
|
|
164
|
+
### Factory Pattern
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
import 'dotenv/config';
|
|
168
|
+
import { MatimoInstance } from 'matimo';
|
|
169
|
+
|
|
170
|
+
const matimo = await MatimoInstance.init({ autoDiscover: true });
|
|
171
|
+
const accountSid = process.env.TWILIO_ACCOUNT_SID;
|
|
172
|
+
|
|
173
|
+
// Send SMS
|
|
174
|
+
const smsResult = await matimo.execute('twilio-send-sms', {
|
|
175
|
+
account_sid: accountSid,
|
|
176
|
+
to: '+15558675310',
|
|
177
|
+
from: '+15557122661',
|
|
178
|
+
body: 'Hello from Matimo!',
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const message = (smsResult as any).data;
|
|
182
|
+
console.info(`✅ SMS sent: ${message.sid} — Status: ${message.status}`);
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Decorator Pattern
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
import 'dotenv/config';
|
|
189
|
+
import { MatimoInstance, tool, setGlobalMatimoInstance } from 'matimo';
|
|
190
|
+
|
|
191
|
+
class TwilioAgent {
|
|
192
|
+
constructor(private readonly accountSid: string) {}
|
|
193
|
+
|
|
194
|
+
@tool('twilio-send-sms')
|
|
195
|
+
async sendSms(
|
|
196
|
+
account_sid: string,
|
|
197
|
+
to: string,
|
|
198
|
+
from: string,
|
|
199
|
+
body: string
|
|
200
|
+
): Promise<unknown> {
|
|
201
|
+
return undefined; // Decorator auto-executes via matimo
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@tool('twilio-list-messages')
|
|
205
|
+
async listMessages(
|
|
206
|
+
account_sid: string,
|
|
207
|
+
page_size?: number
|
|
208
|
+
): Promise<unknown> {
|
|
209
|
+
return undefined; // Decorator auto-executes via matimo
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
async sendMessage(to: string, from: string, body: string) {
|
|
213
|
+
return this.sendSms(this.accountSid, to, from, body);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
async getRecentMessages(count = 20) {
|
|
217
|
+
return this.listMessages(this.accountSid, count);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const matimo = await MatimoInstance.init({ autoDiscover: true });
|
|
222
|
+
setGlobalMatimoInstance(matimo);
|
|
223
|
+
|
|
224
|
+
const agent = new TwilioAgent(process.env.TWILIO_ACCOUNT_SID!);
|
|
225
|
+
const result = await agent.sendMessage('+15558675310', '+15557122661', 'Hello!');
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### LangChain Integration
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
import 'dotenv/config';
|
|
232
|
+
import { MatimoInstance, convertToolsToLangChain, ToolDefinition } from 'matimo';
|
|
233
|
+
import { ChatOpenAI } from '@langchain/openai';
|
|
234
|
+
import { createAgent } from 'langchain';
|
|
235
|
+
|
|
236
|
+
const matimo = await MatimoInstance.init({ autoDiscover: true });
|
|
237
|
+
const twilioTools = matimo.listTools().filter(t => t.name.startsWith('twilio-'));
|
|
238
|
+
|
|
239
|
+
// No extra credential injection needed — Matimo handles Basic Auth automatically
|
|
240
|
+
const langchainTools = await convertToolsToLangChain(
|
|
241
|
+
twilioTools as ToolDefinition[],
|
|
242
|
+
matimo
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
const model = new ChatOpenAI({ modelName: 'gpt-4o-mini', temperature: 0.7 });
|
|
246
|
+
const agent = await createAgent({ model, tools: langchainTools as any[] });
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## 📖 API Reference
|
|
250
|
+
|
|
251
|
+
### `twilio-send-sms`
|
|
252
|
+
|
|
253
|
+
Send an outbound SMS message. Source: [Twilio Messages API — Create a Message](https://www.twilio.com/docs/messaging/api/message-resource#create-a-message-resource)
|
|
254
|
+
|
|
255
|
+
| Parameter | Type | Required | Description |
|
|
256
|
+
|-----------|------|----------|-------------|
|
|
257
|
+
| `account_sid` | string | ✅ | Your Twilio Account SID (starts with `AC`) |
|
|
258
|
+
| `to` | string | ✅ | Recipient phone number in E.164 format (e.g. `+15558675310`) |
|
|
259
|
+
| `from` | string | ✅ | Sender Twilio phone number in E.164 format (e.g. `+15557122661`) |
|
|
260
|
+
| `body` | string | ✅ | Text content of the SMS (up to 1,600 characters; messages over 160 GSM-7 chars are segmented and billed per segment) |
|
|
261
|
+
| `status_callback` | string | ❌ | Webhook URL for delivery status updates |
|
|
262
|
+
|
|
263
|
+
### `twilio-send-mms`
|
|
264
|
+
|
|
265
|
+
Send an outbound MMS message with media.
|
|
266
|
+
|
|
267
|
+
| Parameter | Type | Required | Description |
|
|
268
|
+
|-----------|------|----------|-------------|
|
|
269
|
+
| `account_sid` | string | ✅ | Your Twilio Account SID (starts with `AC`) |
|
|
270
|
+
| `to` | string | ✅ | Recipient phone number in E.164 format |
|
|
271
|
+
| `from` | string | ✅ | Sender Twilio MMS-capable phone number in E.164 format |
|
|
272
|
+
| `media_url` | string | ✅ | Publicly accessible URL of the media file to attach |
|
|
273
|
+
| `body` | string | ❌ | Optional text content to accompany the media |
|
|
274
|
+
| `status_callback` | string | ❌ | Webhook URL for delivery status updates |
|
|
275
|
+
|
|
276
|
+
**Supported media types**: jpeg, jpg, gif, png (up to 5 MB); other types up to 500 KB. Up to 10 `media_url` values per message.
|
|
277
|
+
|
|
278
|
+
### `twilio-get-message`
|
|
279
|
+
|
|
280
|
+
Fetch a single Message resource by SID. Source: [Twilio — Fetch a Message resource](https://www.twilio.com/docs/messaging/api/message-resource#fetch-a-message-resource)
|
|
281
|
+
|
|
282
|
+
| Parameter | Type | Required | Description |
|
|
283
|
+
|-----------|------|----------|-------------|
|
|
284
|
+
| `account_sid` | string | ✅ | Your Twilio Account SID |
|
|
285
|
+
| `message_sid` | string | ✅ | The Message SID to fetch (`SM...` for SMS, `MM...` for MMS) |
|
|
286
|
+
|
|
287
|
+
### `twilio-list-messages`
|
|
288
|
+
|
|
289
|
+
List Message resources with optional filters. Results are sorted by `DateSent`, most recent first. Source: [Twilio — Read multiple Message resources](https://www.twilio.com/docs/messaging/api/message-resource#read-multiple-message-resources)
|
|
290
|
+
|
|
291
|
+
| Parameter | Type | Required | Description |
|
|
292
|
+
|-----------|------|----------|-------------|
|
|
293
|
+
| `account_sid` | string | ✅ | Your Twilio Account SID |
|
|
294
|
+
| `to` | string | ❌ | Filter by recipient phone number (E.164 format) |
|
|
295
|
+
| `from` | string | ❌ | Filter by sender phone number (E.164 format) |
|
|
296
|
+
| `date_sent` | string | ❌ | Filter by sent date: `YYYY-MM-DD`, `<=YYYY-MM-DD`, or `>=YYYY-MM-DD` |
|
|
297
|
+
| `page_size` | number | ❌ | Results per page (default: `50`, max: `1000`) |
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## 📊 Message Status Values
|
|
302
|
+
|
|
303
|
+
Source: [Twilio Message Status Values](https://www.twilio.com/docs/messaging/api/message-resource#message-status-values)
|
|
304
|
+
|
|
305
|
+
| Status | Applies To | Description |
|
|
306
|
+
|--------|-----------|-------------|
|
|
307
|
+
| `queued` | Outbound | API request accepted; message is queued for a specific sender |
|
|
308
|
+
| `sending` | Outbound | Dispatching to the nearest upstream carrier |
|
|
309
|
+
| `sent` | Outbound | Accepted by the upstream carrier |
|
|
310
|
+
| `delivered` | Outbound | Confirmed delivery to the destination handset |
|
|
311
|
+
| `undelivered` | Outbound | Carrier delivery receipt indicates non-delivery (e.g. carrier filtering, handset unavailable) |
|
|
312
|
+
| `failed` | Outbound | Failed to send (e.g. queue overflow, account suspension, media error) |
|
|
313
|
+
| `receiving` | Inbound | Message received by Twilio; processing in progress |
|
|
314
|
+
| `received` | Inbound | Inbound message received and processing complete |
|
|
315
|
+
| `accepted` | Outbound (Messaging Service) | Sender is being dynamically selected from a Messaging Service Sender Pool |
|
|
316
|
+
| `scheduled` | Outbound (Messaging Service) | Message is scheduled for future delivery |
|
|
317
|
+
| `canceled` | Outbound (Messaging Service) | Scheduled message was canceled |
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## ⚠️ Rate Limits
|
|
322
|
+
|
|
323
|
+
Twilio queues messages up to your prescribed rate limits. Requests that exceed the rate are queued and executed as capacity allows.
|
|
324
|
+
|
|
325
|
+
| Number Type | Throughput |
|
|
326
|
+
|-------------|-----------|
|
|
327
|
+
| Short codes (US) | Up to 100 messages/second |
|
|
328
|
+
| Long codes / 10DLC (US) | Typically 1 message/second per number |
|
|
329
|
+
| Toll-free numbers (US) | Varies; depends on verification tier |
|
|
330
|
+
| International long codes | Country-dependent; see [carrier limits](https://help.twilio.com/articles/223183648) |
|
|
331
|
+
|
|
332
|
+
For high-volume messaging, use [Twilio Messaging Services](https://www.twilio.com/docs/messaging/services) to pool multiple senders and increase throughput.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## 🔧 Troubleshooting
|
|
337
|
+
|
|
338
|
+
### `HTTP 401 — Authentication Failed (Error 20003)`
|
|
339
|
+
|
|
340
|
+
Your `TWILIO_AUTH_TOKEN` is incorrect or does not match the `TWILIO_ACCOUNT_SID`. Both values must come from the same Twilio account.
|
|
341
|
+
|
|
342
|
+
1. Go to your [Twilio Console dashboard](https://console.twilio.com)
|
|
343
|
+
2. Under **Account Info**, copy the **Account SID** (starts with `AC`)
|
|
344
|
+
3. Click the **eye icon** next to **Auth Token** to reveal it, then copy the exact value
|
|
345
|
+
4. Update your environment variables — Matimo encodes them automatically, no base64 step needed
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
349
|
+
TWILIO_AUTH_TOKEN=your_32_char_auth_token_here
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
### `Error 21659 — Unverified "To" Phone Number (Trial Accounts)`
|
|
355
|
+
|
|
356
|
+
Your account is in trial mode and you are trying to send to a number that has not been verified as a Caller ID.
|
|
357
|
+
|
|
358
|
+
**Fix — verify the recipient number:**
|
|
359
|
+
1. Go to [Verified Caller IDs](https://console.twilio.com/us1/develop/phone-numbers/manage/verified) in the Console
|
|
360
|
+
2. Click **Add a new Caller ID** and enter the recipient number in E.164 format
|
|
361
|
+
3. Select **SMS** as the verification method (trial accounts cannot use voice verification)
|
|
362
|
+
4. Enter the code sent to that number to complete verification
|
|
363
|
+
|
|
364
|
+
Alternatively, [upgrade your Twilio account](https://help.twilio.com/articles/223183208-Upgrading-to-a-paid-Twilio-Account) to remove this restriction and send to any number.
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
### `Error 21266 — Cannot Use Same "To" and "From" Number`
|
|
369
|
+
|
|
370
|
+
The `to` and `from` phone numbers are identical. Twilio does not allow a number to message itself. Use a different verified recipient number.
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
### `Error 21211 — Invalid "To" Phone Number`
|
|
375
|
+
|
|
376
|
+
The `to` value is not a valid dialable phone number. Ensure it is in **E.164 format** — a `+` sign followed by the country code and number, with no spaces or dashes (e.g. `+15558675310`).
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
### `Error 21212 — Invalid "From" Phone Number`
|
|
381
|
+
|
|
382
|
+
The `from` number is not a Twilio number in your account, or it is not SMS-capable.
|
|
383
|
+
|
|
384
|
+
1. Check your provisioned numbers at [Active Numbers](https://console.twilio.com/us1/develop/phone-numbers/manage/incoming)
|
|
385
|
+
2. Confirm the number has **SMS capability** enabled
|
|
386
|
+
3. Ensure the number is in E.164 format
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
### `Error 21408 — Permission to Send an SMS Has Not Been Enabled`
|
|
391
|
+
|
|
392
|
+
Sending to the target country requires geographic permission approval.
|
|
393
|
+
|
|
394
|
+
1. Go to [Messaging Geographic Permissions](https://console.twilio.com/us1/develop/sms/settings/geo-permissions) in the Console
|
|
395
|
+
2. Enable the target country
|
|
396
|
+
3. If on a trial account, also confirm the recipient is a [Verified Caller ID](https://console.twilio.com/us1/develop/phone-numbers/manage/verified)
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
### `Error 63038 — Daily Message Limit Exceeded (Trial Only)`
|
|
401
|
+
|
|
402
|
+
Trial accounts are limited to **50 messages per day**. You have reached that limit.
|
|
403
|
+
|
|
404
|
+
- Wait until the next calendar day (UTC) for the limit to reset
|
|
405
|
+
- Or [upgrade your Twilio account](https://help.twilio.com/articles/223183208-Upgrading-to-a-paid-Twilio-Account) to remove this restriction
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
### `Error 30007 — Carrier Violation`
|
|
410
|
+
|
|
411
|
+
The carrier blocked the message. Common causes:
|
|
412
|
+
- Content flagged as spam or containing prohibited URL shorteners
|
|
413
|
+
- Unregistered US toll-free numbers sending application-to-person (A2P) traffic
|
|
414
|
+
- Unregistered 10DLC long codes sending to US recipients
|
|
415
|
+
|
|
416
|
+
**Fixes:**
|
|
417
|
+
- Complete [Toll-Free Verification](https://www.twilio.com/docs/messaging/compliance/toll-free/console-onboarding) if using a US toll-free number (requires paid account)
|
|
418
|
+
- Register for [A2P 10DLC](https://help.twilio.com/articles/1260801864489) if using a US 10-digit long code number (requires paid account)
|
|
419
|
+
- Review your message content for spam-like patterns
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
### Messages Arrive with "Sent from a Twilio trial account" Prefix
|
|
424
|
+
|
|
425
|
+
This prefix is automatically prepended by Twilio on all outbound messages from trial accounts. It is **not a Matimo behaviour** — it is a Twilio trial restriction. Upgrading your account removes this prefix immediately.
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
### `account_sid` Is Required on Every Tool Call
|
|
430
|
+
|
|
431
|
+
Every tool requires `account_sid` because Twilio uses it in the API URL path (`/2010-04-01/Accounts/{AccountSid}/Messages.json`). Always pass your Account SID:
|
|
432
|
+
|
|
433
|
+
```typescript
|
|
434
|
+
await matimo.execute('twilio-send-sms', {
|
|
435
|
+
account_sid: process.env.TWILIO_ACCOUNT_SID, // required on every call
|
|
436
|
+
to: '+15558675310',
|
|
437
|
+
from: '+15557122661',
|
|
438
|
+
body: 'Hello!',
|
|
439
|
+
});
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## 🤝 Contributing
|
|
445
|
+
|
|
446
|
+
See the [Contributing Guide](../../CONTRIBUTING.md) for details on how to add new tools, report bugs, or improve documentation.
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
*Part of the [Matimo](https://github.com/tallclub/matimo) ecosystem — universal AI tools SDK.*
|
|
451
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64"><g transform="matrix(.937042 0 0 .937042 0 .046624)" fill="#e31e26"><path d="M34.1 0C15.3 0 0 15.3 0 34.1s15.3 34.1 34.1 34.1C53 68.3 68.3 53 68.3 34.1S53 0 34.1 0zm0 59.3C20.3 59.3 9 48 9 34.1 9 20.3 20.3 9 34.1 9 48 9 59.3 20.3 59.3 34.1 59.3 48 48 59.3 34.1 59.3z"/><circle cx="42.6" cy="25.6" r="7.1"/><circle cx="42.6" cy="42.6" r="7.1"/><circle cx="25.6" cy="42.6" r="7.1"/><circle cx="25.6" cy="25.6" r="7.1"/></g></svg>
|
package/definition.yaml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Twilio Provider Definition
|
|
2
|
+
#
|
|
3
|
+
# This file defines provider metadata for Twilio Programmable Messaging.
|
|
4
|
+
# Twilio REST API uses HTTP Basic authentication:
|
|
5
|
+
# Username = Account SID (ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
|
|
6
|
+
# Password = Auth Token
|
|
7
|
+
#
|
|
8
|
+
# Setup:
|
|
9
|
+
# 1. Log in to Twilio Console: https://console.twilio.com
|
|
10
|
+
# 2. Find your Account SID and Auth Token on the dashboard
|
|
11
|
+
# 3. Set environment variables:
|
|
12
|
+
# export TWILIO_ACCOUNT_SID="ACxxxxxxxxxx"
|
|
13
|
+
# export TWILIO_AUTH_TOKEN="your_auth_token"
|
|
14
|
+
# (Matimo automatically handles base64 encoding — no extra steps needed)
|
|
15
|
+
# 4. Pass account_sid as a parameter to each tool call
|
|
16
|
+
|
|
17
|
+
name: twilio-provider
|
|
18
|
+
type: provider
|
|
19
|
+
version: '1.0.0'
|
|
20
|
+
tags:
|
|
21
|
+
- Messaging
|
|
22
|
+
- SMS
|
|
23
|
+
- MMS
|
|
24
|
+
- Communications
|
|
25
|
+
|
|
26
|
+
description: |
|
|
27
|
+
Twilio Programmable Messaging API Provider Configuration
|
|
28
|
+
|
|
29
|
+
All Twilio tools use HTTP Basic authentication.
|
|
30
|
+
Matimo natively handles base64 encoding — just set two env vars:
|
|
31
|
+
TWILIO_ACCOUNT_SID = your Account SID (ACxxxxxxxxxx)
|
|
32
|
+
TWILIO_AUTH_TOKEN = your Auth Token (from the Twilio Console dashboard)
|
|
33
|
+
|
|
34
|
+
Authentication is automatically injected as: Authorization: Basic base64(AccountSid:AuthToken)
|
|
35
|
+
Pass your Account SID as the `account_sid` parameter to each tool call.
|
|
36
|
+
|
|
37
|
+
API Documentation: https://www.twilio.com/docs/messaging/api/message-resource
|
|
38
|
+
|
|
39
|
+
assets:
|
|
40
|
+
icon: assets/twilio-icon.svg
|
|
41
|
+
logo: assets/twilio-logo.svg
|
|
42
|
+
brand_color: '#F22F46'
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@matimo/twilio",
|
|
3
|
+
"version": "0.1.0-alpha.11",
|
|
4
|
+
"description": "Twilio messaging tools for Matimo — send SMS, MMS, and manage messages",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"tools",
|
|
8
|
+
"README.md",
|
|
9
|
+
"definition.yaml",
|
|
10
|
+
"assets"
|
|
11
|
+
],
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"matimo": "0.1.0-alpha.11"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"typescript": "^5.9.3",
|
|
17
|
+
"@matimo/core": "0.1.0-alpha.11"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
name: twilio-get-message
|
|
2
|
+
version: '1.0.0'
|
|
3
|
+
description: >
|
|
4
|
+
Fetch a single Message resource from the Twilio Programmable Messaging API.
|
|
5
|
+
Returns the full details of a message identified by its Message SID,
|
|
6
|
+
including its current status, body, sender, recipient, and timestamps.
|
|
7
|
+
|
|
8
|
+
parameters:
|
|
9
|
+
account_sid:
|
|
10
|
+
type: string
|
|
11
|
+
required: true
|
|
12
|
+
description: >
|
|
13
|
+
The SID of the Account associated with the Message resource.
|
|
14
|
+
Found on the Twilio Console dashboard: https://console.twilio.com
|
|
15
|
+
Pattern: ^AC[0-9a-fA-F]{32}$
|
|
16
|
+
message_sid:
|
|
17
|
+
type: string
|
|
18
|
+
required: true
|
|
19
|
+
description: >
|
|
20
|
+
The SID of the Message resource to fetch.
|
|
21
|
+
Pattern: ^(SM|MM)[0-9a-fA-F]{32}$
|
|
22
|
+
SMS messages start with "SM", MMS messages start with "MM".
|
|
23
|
+
|
|
24
|
+
execution:
|
|
25
|
+
type: http
|
|
26
|
+
method: GET
|
|
27
|
+
url: 'https://api.twilio.com/2010-04-01/Accounts/{account_sid}/Messages/{message_sid}.json'
|
|
28
|
+
timeout: 30000
|
|
29
|
+
|
|
30
|
+
authentication:
|
|
31
|
+
type: basic
|
|
32
|
+
username_env: TWILIO_ACCOUNT_SID
|
|
33
|
+
password_env: TWILIO_AUTH_TOKEN
|
|
34
|
+
|
|
35
|
+
output_schema:
|
|
36
|
+
type: object
|
|
37
|
+
properties:
|
|
38
|
+
success:
|
|
39
|
+
type: boolean
|
|
40
|
+
description: Whether the HTTP request was successful (2xx status)
|
|
41
|
+
data:
|
|
42
|
+
type: object
|
|
43
|
+
description: The Twilio Message resource
|
|
44
|
+
properties:
|
|
45
|
+
sid:
|
|
46
|
+
type: string
|
|
47
|
+
description: The unique SID identifying this Message resource
|
|
48
|
+
account_sid:
|
|
49
|
+
type: string
|
|
50
|
+
description: The SID of the Account associated with this Message
|
|
51
|
+
to:
|
|
52
|
+
type: string
|
|
53
|
+
description: The recipient's phone number in E.164 format
|
|
54
|
+
from:
|
|
55
|
+
type: string
|
|
56
|
+
description: The sender's phone number in E.164 format
|
|
57
|
+
body:
|
|
58
|
+
type: string
|
|
59
|
+
description: The text content of the message (empty string if redacted)
|
|
60
|
+
status:
|
|
61
|
+
type: string
|
|
62
|
+
description: >
|
|
63
|
+
The current status of the Message.
|
|
64
|
+
Possible values: queued, sending, sent, failed, delivered, undelivered,
|
|
65
|
+
receiving, received, accepted, scheduled, canceled, read
|
|
66
|
+
direction:
|
|
67
|
+
type: string
|
|
68
|
+
description: >
|
|
69
|
+
The direction of the message.
|
|
70
|
+
Possible values: inbound, outbound-api, outbound-call, outbound-reply
|
|
71
|
+
date_created:
|
|
72
|
+
type: string
|
|
73
|
+
description: The RFC 2822 timestamp (GMT) when the Message resource was created
|
|
74
|
+
date_sent:
|
|
75
|
+
type: string
|
|
76
|
+
description: The RFC 2822 timestamp (GMT) when the message was sent
|
|
77
|
+
date_updated:
|
|
78
|
+
type: string
|
|
79
|
+
description: The RFC 2822 timestamp (GMT) when the Message resource was last updated
|
|
80
|
+
error_code:
|
|
81
|
+
type: string
|
|
82
|
+
description: The error code if status is failed or undelivered, otherwise null
|
|
83
|
+
error_message:
|
|
84
|
+
type: string
|
|
85
|
+
description: The description of the error_code, otherwise null
|
|
86
|
+
price:
|
|
87
|
+
type: string
|
|
88
|
+
description: The amount billed for the message in the currency of price_unit
|
|
89
|
+
price_unit:
|
|
90
|
+
type: string
|
|
91
|
+
description: The currency in which price is measured (ISO 4127 format, e.g. usd)
|
|
92
|
+
num_segments:
|
|
93
|
+
type: string
|
|
94
|
+
description: Number of SMS segments that make up the complete message
|
|
95
|
+
num_media:
|
|
96
|
+
type: string
|
|
97
|
+
description: Number of media files associated with the Message resource
|
|
98
|
+
messaging_service_sid:
|
|
99
|
+
type: string
|
|
100
|
+
description: The SID of the Messaging Service associated with this Message
|
|
101
|
+
api_version:
|
|
102
|
+
type: string
|
|
103
|
+
description: The API version used to process the Message
|
|
104
|
+
uri:
|
|
105
|
+
type: string
|
|
106
|
+
description: The URI of this Message resource, relative to https://api.twilio.com
|
|
107
|
+
subresource_uris:
|
|
108
|
+
type: object
|
|
109
|
+
description: URIs of sub-resources (media, feedback) relative to the API root
|
|
110
|
+
statusCode:
|
|
111
|
+
type: number
|
|
112
|
+
description: HTTP status code of the response
|
|
113
|
+
|
|
114
|
+
error_handling:
|
|
115
|
+
retry: 2
|
|
116
|
+
backoff_type: exponential
|
|
117
|
+
initial_delay_ms: 500
|
|
118
|
+
retry_on_status:
|
|
119
|
+
- 429
|
|
120
|
+
- 500
|
|
121
|
+
- 503
|
|
122
|
+
|
|
123
|
+
examples:
|
|
124
|
+
- name: 'Fetch an SMS message by SID'
|
|
125
|
+
params:
|
|
126
|
+
account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
127
|
+
message_sid: SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
128
|
+
expected_result: 'Returns full Message resource including current status, body, and timestamps'
|
|
129
|
+
- name: 'Fetch an MMS message by SID'
|
|
130
|
+
params:
|
|
131
|
+
account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
132
|
+
message_sid: MMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
133
|
+
expected_result: 'Returns Message resource with num_media > 0 and subresource_uris.media'
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
name: twilio-list-messages
|
|
2
|
+
version: '1.0.0'
|
|
3
|
+
description: >
|
|
4
|
+
Read multiple Message resources from the Twilio Programmable Messaging API.
|
|
5
|
+
Returns a paginated list of messages in your account, sorted by DateSent
|
|
6
|
+
with the most recent messages appearing first. Supports filtering by
|
|
7
|
+
recipient (To), sender (From), and sent date.
|
|
8
|
+
See: https://www.twilio.com/docs/messaging/api/message-resource#read-multiple-message-resources
|
|
9
|
+
|
|
10
|
+
parameters:
|
|
11
|
+
account_sid:
|
|
12
|
+
type: string
|
|
13
|
+
required: true
|
|
14
|
+
description: >
|
|
15
|
+
The SID of the Account associated with the Message resources.
|
|
16
|
+
Found on the Twilio Console dashboard: https://console.twilio.com
|
|
17
|
+
Pattern: ^AC[0-9a-fA-F]{32}$
|
|
18
|
+
to:
|
|
19
|
+
type: string
|
|
20
|
+
required: false
|
|
21
|
+
description: >
|
|
22
|
+
Filter by recipient phone number.
|
|
23
|
+
E.g. "+15558881111" to retrieve messages sent to that number.
|
|
24
|
+
Must be in E.164 format.
|
|
25
|
+
from:
|
|
26
|
+
type: string
|
|
27
|
+
required: false
|
|
28
|
+
description: >
|
|
29
|
+
Filter by sender phone number.
|
|
30
|
+
E.g. "+15552229999" to retrieve messages sent from that number.
|
|
31
|
+
Must be in E.164 format.
|
|
32
|
+
date_sent:
|
|
33
|
+
type: string
|
|
34
|
+
required: false
|
|
35
|
+
description: >
|
|
36
|
+
Filter by the sent date (GMT). Accepts dates in formats:
|
|
37
|
+
YYYY-MM-DD — messages with this specific sent date
|
|
38
|
+
<=YYYY-MM-DD — messages with sent_date on or before this date
|
|
39
|
+
>=YYYY-MM-DD — messages with sent_date on or after this date
|
|
40
|
+
page_size:
|
|
41
|
+
type: number
|
|
42
|
+
required: false
|
|
43
|
+
description: >
|
|
44
|
+
How many Message resources to return per page.
|
|
45
|
+
Default is 50. Maximum is 1000. Minimum is 1.
|
|
46
|
+
default: 50
|
|
47
|
+
min: 1
|
|
48
|
+
max: 1000
|
|
49
|
+
|
|
50
|
+
execution:
|
|
51
|
+
type: http
|
|
52
|
+
method: GET
|
|
53
|
+
url: 'https://api.twilio.com/2010-04-01/Accounts/{account_sid}/Messages.json'
|
|
54
|
+
query_params:
|
|
55
|
+
To: '{to}'
|
|
56
|
+
From: '{from}'
|
|
57
|
+
DateSent: '{date_sent}'
|
|
58
|
+
PageSize: '{page_size}'
|
|
59
|
+
timeout: 30000
|
|
60
|
+
|
|
61
|
+
authentication:
|
|
62
|
+
type: basic
|
|
63
|
+
username_env: TWILIO_ACCOUNT_SID
|
|
64
|
+
password_env: TWILIO_AUTH_TOKEN
|
|
65
|
+
|
|
66
|
+
output_schema:
|
|
67
|
+
type: object
|
|
68
|
+
properties:
|
|
69
|
+
success:
|
|
70
|
+
type: boolean
|
|
71
|
+
description: Whether the HTTP request was successful (2xx status)
|
|
72
|
+
data:
|
|
73
|
+
type: object
|
|
74
|
+
description: The paginated list of Message resources
|
|
75
|
+
properties:
|
|
76
|
+
messages:
|
|
77
|
+
type: array
|
|
78
|
+
description: Array of Message resource objects
|
|
79
|
+
end:
|
|
80
|
+
type: number
|
|
81
|
+
description: Index of the last record in the current page (0-based)
|
|
82
|
+
first_page_uri:
|
|
83
|
+
type: string
|
|
84
|
+
description: URI of the first page of results
|
|
85
|
+
next_page_uri:
|
|
86
|
+
type: string
|
|
87
|
+
description: URI of the next page of results (null if no more pages)
|
|
88
|
+
previous_page_uri:
|
|
89
|
+
type: string
|
|
90
|
+
description: URI of the previous page of results (null on first page)
|
|
91
|
+
page:
|
|
92
|
+
type: number
|
|
93
|
+
description: The current page index (0-based)
|
|
94
|
+
page_size:
|
|
95
|
+
type: number
|
|
96
|
+
description: The number of records per page
|
|
97
|
+
start:
|
|
98
|
+
type: number
|
|
99
|
+
description: Index of the first record in the current page (0-based)
|
|
100
|
+
uri:
|
|
101
|
+
type: string
|
|
102
|
+
description: URI of the current page of results
|
|
103
|
+
statusCode:
|
|
104
|
+
type: number
|
|
105
|
+
description: HTTP status code of the response
|
|
106
|
+
|
|
107
|
+
error_handling:
|
|
108
|
+
retry: 2
|
|
109
|
+
backoff_type: exponential
|
|
110
|
+
initial_delay_ms: 500
|
|
111
|
+
retry_on_status:
|
|
112
|
+
- 429
|
|
113
|
+
- 500
|
|
114
|
+
- 503
|
|
115
|
+
|
|
116
|
+
examples:
|
|
117
|
+
- name: 'List recent messages (default page size 50)'
|
|
118
|
+
params:
|
|
119
|
+
account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
120
|
+
expected_result: 'Returns up to 50 most recent messages with pagination metadata'
|
|
121
|
+
- name: 'List messages sent to a specific number'
|
|
122
|
+
params:
|
|
123
|
+
account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
124
|
+
to: '+15558675310'
|
|
125
|
+
page_size: 20
|
|
126
|
+
expected_result: 'Returns messages filtered by recipient with pagination'
|
|
127
|
+
- name: 'List messages from a specific sender on a date'
|
|
128
|
+
params:
|
|
129
|
+
account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
130
|
+
from: '+15557122661'
|
|
131
|
+
date_sent: '2024-01-15'
|
|
132
|
+
page_size: 10
|
|
133
|
+
expected_result: 'Returns messages sent from that number on the specified date'
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
name: twilio-send-mms
|
|
2
|
+
version: '1.0.0'
|
|
3
|
+
description: >
|
|
4
|
+
Send an outbound MMS message with one or more media files via the Twilio
|
|
5
|
+
Programmable Messaging API. Supported media types include jpeg, jpg, gif,
|
|
6
|
+
and png (up to 5 MB each), and other accepted media types up to 500 KB.
|
|
7
|
+
Up to 10 media URLs can be included per message.
|
|
8
|
+
|
|
9
|
+
parameters:
|
|
10
|
+
account_sid:
|
|
11
|
+
type: string
|
|
12
|
+
required: true
|
|
13
|
+
description: >
|
|
14
|
+
Your Twilio Account SID (e.g. "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").
|
|
15
|
+
Found on the Twilio Console dashboard: https://console.twilio.com
|
|
16
|
+
to:
|
|
17
|
+
type: string
|
|
18
|
+
required: true
|
|
19
|
+
description: >
|
|
20
|
+
The recipient's phone number in E.164 format (e.g. "+15558675310").
|
|
21
|
+
Must be a valid phone number capable of receiving MMS.
|
|
22
|
+
from:
|
|
23
|
+
type: string
|
|
24
|
+
required: true
|
|
25
|
+
description: >
|
|
26
|
+
The sender's Twilio phone number in E.164 format (e.g. "+15557122661").
|
|
27
|
+
Must be a Twilio MMS-capable number that belongs to your account.
|
|
28
|
+
media_url:
|
|
29
|
+
type: string
|
|
30
|
+
required: true
|
|
31
|
+
description: >
|
|
32
|
+
The URL of a media file to include in the MMS message.
|
|
33
|
+
Fully supported types: jpeg, jpg, gif, png (up to 5 MB).
|
|
34
|
+
Other accepted types: up to 500 KB.
|
|
35
|
+
Must be a publicly accessible URL.
|
|
36
|
+
body:
|
|
37
|
+
type: string
|
|
38
|
+
required: false
|
|
39
|
+
description: >
|
|
40
|
+
Optional text content to accompany the media.
|
|
41
|
+
Can be up to 1,600 characters. Note: WhatsApp does not support
|
|
42
|
+
including a text body in the same message as video, audio, document,
|
|
43
|
+
contact, or location media types.
|
|
44
|
+
status_callback:
|
|
45
|
+
type: string
|
|
46
|
+
required: false
|
|
47
|
+
description: >
|
|
48
|
+
The URL of the endpoint to which Twilio sends Message status callback
|
|
49
|
+
requests when the Message status changes. URL must contain a valid
|
|
50
|
+
hostname and underscores are not allowed.
|
|
51
|
+
|
|
52
|
+
execution:
|
|
53
|
+
type: http
|
|
54
|
+
method: POST
|
|
55
|
+
url: 'https://api.twilio.com/2010-04-01/Accounts/{account_sid}/Messages.json'
|
|
56
|
+
headers:
|
|
57
|
+
Content-Type: application/x-www-form-urlencoded
|
|
58
|
+
body:
|
|
59
|
+
To: '{to}'
|
|
60
|
+
From: '{from}'
|
|
61
|
+
MediaUrl: '{media_url}'
|
|
62
|
+
Body: '{body}'
|
|
63
|
+
StatusCallback: '{status_callback}'
|
|
64
|
+
timeout: 30000
|
|
65
|
+
|
|
66
|
+
authentication:
|
|
67
|
+
type: basic
|
|
68
|
+
username_env: TWILIO_ACCOUNT_SID
|
|
69
|
+
password_env: TWILIO_AUTH_TOKEN
|
|
70
|
+
|
|
71
|
+
output_schema:
|
|
72
|
+
type: object
|
|
73
|
+
properties:
|
|
74
|
+
success:
|
|
75
|
+
type: boolean
|
|
76
|
+
description: Whether the HTTP request was successful (2xx status)
|
|
77
|
+
data:
|
|
78
|
+
type: object
|
|
79
|
+
description: The Twilio Message resource returned by the API
|
|
80
|
+
properties:
|
|
81
|
+
sid:
|
|
82
|
+
type: string
|
|
83
|
+
description: The unique SID identifying this Message resource (e.g. MMxxx for MMS)
|
|
84
|
+
account_sid:
|
|
85
|
+
type: string
|
|
86
|
+
description: The SID of the Account that created this Message resource
|
|
87
|
+
to:
|
|
88
|
+
type: string
|
|
89
|
+
description: The recipient's phone number in E.164 format
|
|
90
|
+
from:
|
|
91
|
+
type: string
|
|
92
|
+
description: The sender's phone number in E.164 format
|
|
93
|
+
body:
|
|
94
|
+
type: string
|
|
95
|
+
description: The text content of the message (if provided)
|
|
96
|
+
status:
|
|
97
|
+
type: string
|
|
98
|
+
description: >
|
|
99
|
+
The status of the Message. For new outbound MMS this is 'queued'.
|
|
100
|
+
Possible values: queued, sending, sent, failed, delivered, undelivered
|
|
101
|
+
direction:
|
|
102
|
+
type: string
|
|
103
|
+
description: The direction of the message (outbound-api for REST API messages)
|
|
104
|
+
date_created:
|
|
105
|
+
type: string
|
|
106
|
+
description: The RFC 2822 timestamp (GMT) when the Message resource was created
|
|
107
|
+
date_sent:
|
|
108
|
+
type: string
|
|
109
|
+
description: The RFC 2822 timestamp (GMT) when the message was sent
|
|
110
|
+
date_updated:
|
|
111
|
+
type: string
|
|
112
|
+
description: The RFC 2822 timestamp (GMT) when the Message resource was last updated
|
|
113
|
+
error_code:
|
|
114
|
+
type: string
|
|
115
|
+
description: The error code if status is failed or undelivered, otherwise null
|
|
116
|
+
error_message:
|
|
117
|
+
type: string
|
|
118
|
+
description: The description of the error_code, otherwise null
|
|
119
|
+
num_media:
|
|
120
|
+
type: string
|
|
121
|
+
description: Number of media files associated with the Message resource
|
|
122
|
+
num_segments:
|
|
123
|
+
type: string
|
|
124
|
+
description: Number of SMS segments (typically '1' for MMS)
|
|
125
|
+
messaging_service_sid:
|
|
126
|
+
type: string
|
|
127
|
+
description: The SID of the Messaging Service associated with this Message
|
|
128
|
+
uri:
|
|
129
|
+
type: string
|
|
130
|
+
description: The URI of this Message resource, relative to https://api.twilio.com
|
|
131
|
+
subresource_uris:
|
|
132
|
+
type: object
|
|
133
|
+
description: URIs of sub-resources (media, feedback) relative to the API root
|
|
134
|
+
statusCode:
|
|
135
|
+
type: number
|
|
136
|
+
description: HTTP status code of the response
|
|
137
|
+
|
|
138
|
+
error_handling:
|
|
139
|
+
retry: 2
|
|
140
|
+
backoff_type: exponential
|
|
141
|
+
initial_delay_ms: 500
|
|
142
|
+
retry_on_status:
|
|
143
|
+
- 429
|
|
144
|
+
- 500
|
|
145
|
+
- 503
|
|
146
|
+
|
|
147
|
+
examples:
|
|
148
|
+
- name: 'Send MMS with image'
|
|
149
|
+
params:
|
|
150
|
+
account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
151
|
+
to: '+15558675310'
|
|
152
|
+
from: '+15557122661'
|
|
153
|
+
media_url: 'https://example.com/images/photo.jpg'
|
|
154
|
+
body: 'Check out this photo!'
|
|
155
|
+
expected_result: 'Returns Message resource with sid (MM...) and num_media: "1"'
|
|
156
|
+
- name: 'Send MMS with image only (no text body)'
|
|
157
|
+
params:
|
|
158
|
+
account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
159
|
+
to: '+15558675310'
|
|
160
|
+
from: '+15557122661'
|
|
161
|
+
media_url: 'https://example.com/logo.png'
|
|
162
|
+
expected_result: 'Returns Message resource with sid and status: queued'
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
name: twilio-send-sms
|
|
2
|
+
version: '1.0.0'
|
|
3
|
+
description: >
|
|
4
|
+
Send an outbound SMS message via the Twilio Programmable Messaging API.
|
|
5
|
+
Sends a text message from a Twilio phone number to any E.164 phone number.
|
|
6
|
+
Returns a Message resource with its SID and initial status of 'queued'.
|
|
7
|
+
|
|
8
|
+
parameters:
|
|
9
|
+
account_sid:
|
|
10
|
+
type: string
|
|
11
|
+
required: true
|
|
12
|
+
description: >
|
|
13
|
+
Your Twilio Account SID (e.g. "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").
|
|
14
|
+
Found on the Twilio Console dashboard: https://console.twilio.com
|
|
15
|
+
to:
|
|
16
|
+
type: string
|
|
17
|
+
required: true
|
|
18
|
+
description: >
|
|
19
|
+
The recipient's phone number in E.164 format (e.g. "+15558675310").
|
|
20
|
+
Must be a valid phone number reachable via SMS.
|
|
21
|
+
from:
|
|
22
|
+
type: string
|
|
23
|
+
required: true
|
|
24
|
+
description: >
|
|
25
|
+
The sender's Twilio phone number in E.164 format (e.g. "+15557122661").
|
|
26
|
+
Must be a Twilio number or short code that belongs to your account.
|
|
27
|
+
body:
|
|
28
|
+
type: string
|
|
29
|
+
required: true
|
|
30
|
+
description: >
|
|
31
|
+
The text content of the outgoing SMS message.
|
|
32
|
+
Can be up to 1,600 characters. Bodies exceeding 160 GSM-7 characters
|
|
33
|
+
are segmented and each segment is charged separately.
|
|
34
|
+
status_callback:
|
|
35
|
+
type: string
|
|
36
|
+
required: false
|
|
37
|
+
description: >
|
|
38
|
+
The URL of the endpoint to which Twilio sends Message status callback
|
|
39
|
+
requests when the Message status changes. URL must contain a valid
|
|
40
|
+
hostname and underscores are not allowed.
|
|
41
|
+
|
|
42
|
+
execution:
|
|
43
|
+
type: http
|
|
44
|
+
method: POST
|
|
45
|
+
url: 'https://api.twilio.com/2010-04-01/Accounts/{account_sid}/Messages.json'
|
|
46
|
+
headers:
|
|
47
|
+
Content-Type: application/x-www-form-urlencoded
|
|
48
|
+
body:
|
|
49
|
+
To: '{to}'
|
|
50
|
+
From: '{from}'
|
|
51
|
+
Body: '{body}'
|
|
52
|
+
StatusCallback: '{status_callback}'
|
|
53
|
+
timeout: 30000
|
|
54
|
+
|
|
55
|
+
authentication:
|
|
56
|
+
type: basic
|
|
57
|
+
username_env: TWILIO_ACCOUNT_SID
|
|
58
|
+
password_env: TWILIO_AUTH_TOKEN
|
|
59
|
+
|
|
60
|
+
output_schema:
|
|
61
|
+
type: object
|
|
62
|
+
properties:
|
|
63
|
+
success:
|
|
64
|
+
type: boolean
|
|
65
|
+
description: Whether the HTTP request was successful (2xx status)
|
|
66
|
+
data:
|
|
67
|
+
type: object
|
|
68
|
+
description: The Twilio Message resource returned by the API
|
|
69
|
+
properties:
|
|
70
|
+
sid:
|
|
71
|
+
type: string
|
|
72
|
+
description: The unique SID identifying this Message resource (e.g. SMxxx)
|
|
73
|
+
account_sid:
|
|
74
|
+
type: string
|
|
75
|
+
description: The SID of the Account that created this Message resource
|
|
76
|
+
to:
|
|
77
|
+
type: string
|
|
78
|
+
description: The recipient's phone number in E.164 format
|
|
79
|
+
from:
|
|
80
|
+
type: string
|
|
81
|
+
description: The sender's phone number in E.164 format
|
|
82
|
+
body:
|
|
83
|
+
type: string
|
|
84
|
+
description: The text content of the message
|
|
85
|
+
status:
|
|
86
|
+
type: string
|
|
87
|
+
description: >
|
|
88
|
+
The status of the Message. For new outbound messages this is 'queued'.
|
|
89
|
+
Possible values: queued, sending, sent, failed, delivered, undelivered
|
|
90
|
+
direction:
|
|
91
|
+
type: string
|
|
92
|
+
description: The direction of the message (outbound-api for REST API messages)
|
|
93
|
+
date_created:
|
|
94
|
+
type: string
|
|
95
|
+
description: The RFC 2822 timestamp (GMT) when the Message resource was created
|
|
96
|
+
date_sent:
|
|
97
|
+
type: string
|
|
98
|
+
description: The RFC 2822 timestamp (GMT) when the message was sent
|
|
99
|
+
date_updated:
|
|
100
|
+
type: string
|
|
101
|
+
description: The RFC 2822 timestamp (GMT) when the Message resource was last updated
|
|
102
|
+
error_code:
|
|
103
|
+
type: string
|
|
104
|
+
description: The error code if status is failed or undelivered, otherwise null
|
|
105
|
+
error_message:
|
|
106
|
+
type: string
|
|
107
|
+
description: The description of the error_code, otherwise null
|
|
108
|
+
num_segments:
|
|
109
|
+
type: string
|
|
110
|
+
description: Number of SMS segments the message body comprises
|
|
111
|
+
num_media:
|
|
112
|
+
type: string
|
|
113
|
+
description: Number of media files associated with the Message resource
|
|
114
|
+
messaging_service_sid:
|
|
115
|
+
type: string
|
|
116
|
+
description: The SID of the Messaging Service associated with this Message
|
|
117
|
+
uri:
|
|
118
|
+
type: string
|
|
119
|
+
description: The URI of this Message resource, relative to https://api.twilio.com
|
|
120
|
+
statusCode:
|
|
121
|
+
type: number
|
|
122
|
+
description: HTTP status code of the response
|
|
123
|
+
|
|
124
|
+
error_handling:
|
|
125
|
+
retry: 2
|
|
126
|
+
backoff_type: exponential
|
|
127
|
+
initial_delay_ms: 500
|
|
128
|
+
retry_on_status:
|
|
129
|
+
- 429
|
|
130
|
+
- 500
|
|
131
|
+
- 503
|
|
132
|
+
|
|
133
|
+
examples:
|
|
134
|
+
- name: 'Send a simple SMS'
|
|
135
|
+
params:
|
|
136
|
+
account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
137
|
+
to: '+15558675310'
|
|
138
|
+
from: '+15557122661'
|
|
139
|
+
body: 'Hello from Matimo!'
|
|
140
|
+
expected_result: 'Returns Message resource with sid and status: queued'
|
|
141
|
+
- name: 'Send SMS with delivery callback'
|
|
142
|
+
params:
|
|
143
|
+
account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
144
|
+
to: '+15558675310'
|
|
145
|
+
from: '+15557122661'
|
|
146
|
+
body: 'Your order has shipped!'
|
|
147
|
+
status_callback: 'https://your-app.com/twilio/status'
|
|
148
|
+
expected_result: 'Returns Message resource; Twilio POSTs status updates to the callback URL'
|
|
149
|
+
- name: 'Send long SMS (multi-segment)'
|
|
150
|
+
params:
|
|
151
|
+
account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
152
|
+
to: '+15558675310'
|
|
153
|
+
from: '+15557122661'
|
|
154
|
+
body: 'This is a long message that exceeds 160 GSM-7 characters. It will be split into multiple segments and each segment will be charged accordingly. Make sure your Twilio account has sufficient balance.'
|
|
155
|
+
expected_result: 'Returns Message resource with num_segments > 1'
|