@kody/twilio
Look up Twilio accounts, incoming numbers, and SMS logs, and send messages as a dry-run by default.
Files
@kody/twilio — agent notes
Human setup and intent live in README.md. This file is for
agents: imports, smoke/dryRun execute snippets, and edge cases. Secrets by
name only — never paste SID or Auth Token values. Do not disable live
webhooks or jobs (this package declares none). There is no Twilio OAuth path —
do not open /connect/oauth for Twilio.
Secrets
| Name | Purpose |
|---|---|
twilioAccountSid | Account SID (AC…); Basic username + REST path |
twilioAuthToken | Auth Token; Basic password |
twilioAccountSid-<label> / twilioAuthToken-<label> | Extra account via account: "<label>" or explicit secret overrides |
Host: api.twilio.com (approve for both secrets).
Import paths
| Export | Import |
|---|---|
| overview / safety metadata | kody:@kody/twilio |
| guide | kody:@kody/twilio/guide |
| smoke-test | kody:@kody/twilio/smoke-test |
| account | kody:@kody/twilio/account |
| incoming-numbers | kody:@kody/twilio/incoming-numbers |
| messages | kody:@kody/twilio/messages |
| send-message | kody:@kody/twilio/send-message |
| config | kody:@kody/twilio/config |
| request | kody:@kody/twilio/request |
Prefer static kody:@kody/twilio/... imports from execute. Do not lead with
packages.invoke. If a forked package runtime must bind the caller's secret
mounts and a static import does not resolve placeholders, a dynamic invoke of
bare kody id twilio with exportName: './smoke-test' is acceptable.
Smoke test (read-only)
Safe before credentials exist: returns { ok: true, live: false } and setup
URLs. After both secrets and host approval, a live result is account + one page
of numbers and message logs. It does not send SMS.
import smokeTest from 'kody:@kody/twilio/smoke-test'
export default async function main() {
return await smokeTest()
}Static overview (no secret mounts required):
import twilio from 'kody:@kody/twilio'
export default async function main() {
return await twilio()
}dryRun / confirm (sends)
send-message and other POST helpers default to dry-run. They return the
Twilio form payload without calling the API unless confirm: true (and
dryRun is not true). Live sends also need from or messagingServiceSid.
import sendMessage from 'kody:@kody/twilio/send-message'
export default async function main() {
return await sendMessage({
to: '+15555550100',
from: '+15555550101',
body: 'Hello from Kody',
})
// preview only
}A live send only after explicit user approval of the exact destination and body:
import sendMessage from 'kody:@kody/twilio/send-message'
export default async function main() {
return await sendMessage({
to: '+15555550100',
from: '+15555550101',
body: 'Hello from Kody',
confirm: true,
})
}Edge cases
- No default sender. Pass
from(E.164) or a Messaging Service SID. Optional Messaging Service SID may live in forkedpackageStorage()via./config— never on the live@kody/twilioplatform bucket. - Errors: 401 → save both secrets and approve
api.twilio.com; 403 → SID and token must belong to the same account; 404 → confirm Account SID / path; 400 missing From → passfromor Messaging Service SID. - Keep
LICENSE(MIT),## Intent, andcommunity-icon.svgfor community listing.