Skip to content
← Community packages

Look up Twilio accounts, incoming numbers, and SMS logs, and send messages as a dry-run by default.

Browse files

  • Other
  • twilio
  • sms
  • messaging
  • phone
  • account-sid
  • auth-token
  • dry-run
License
MIT
Published
August 22, 2026
Pinned commit
9c38e3d
Rating
No ratings yet
Forks
0
Stars
0
Adaptation effort

README

@kody/twilio

Official Twilio four-dot mark (Simple Icons path of Twilio's logo) in Signal Red #F22F46. Twilio® is a trademark of Twilio Inc. This package is not affiliated with or endorsed by Twilio.

Intent

Provide reusable, account-agnostic Twilio helpers so Kody can look up the caller's account, list incoming numbers, read message logs, and send SMS. Auth is a saved Account SID plus Auth Token. Sends default to dry-run and need confirm: true for a live message. No personal phone numbers belong in this package — pass from/to or a Messaging Service SID at call time.

This listing is meant to be forked. The live @kody/twilio package does not talk to a shared Twilio account.

Auth

Account SID + Auth Token (secret-backed HTTP Basic). There is no Twilio OAuth integration and no baked-in sender. Do not open /connect/oauth for Twilio.

SecretPurpose
twilioAccountSidAccount SID (AC…) used as the Basic username and in the REST path
twilioAuthTokenAuth Token used as the Basic password

Optional readable default (not a secret): store a Messaging Service SID (MG…) in this package's packageStorage() after you fork. Live @kody/twilio storage is the platform bucket — fork first.

Required setup

  1. Copy the Account SID and Auth Token from the Twilio Console. Never paste them into chat.
  2. Save the Account SID:

https://kody.codes/account/secrets/new?name=twilioAccountSid&description=Twilio%20Account%20SID%20(AC...)&allowedHosts=api.twilio.com&scope=user

  1. Save the Auth Token:

https://kody.codes/account/secrets/new?name=twilioAuthToken&description=Twilio%20Auth%20Token&allowedHosts=api.twilio.com&scope=user

  1. Approve host api.twilio.com for both secrets.
  2. Run the smoke test below.

Required host: api.twilio.com.

Additional accounts

Pass account: "work" to use twilioAccountSid-work / twilioAuthToken-work, or pass accountSidSecret / authTokenSecret explicitly.

https://kody.codes/account/secrets/new?name=twilioAccountSid-work&description=Twilio%20Account%20SID%20(AC...)&allowedHosts=api.twilio.com&scope=user

https://kody.codes/account/secrets/new?name=twilioAuthToken-work&description=Twilio%20Auth%20Token&allowedHosts=api.twilio.com&scope=user

Exports

  • kody:@kody/twilio — package overview and safety metadata
  • kody:@kody/twilio/guide — console steps and prefilled secret URLs
  • kody:@kody/twilio/smoke-test — dry-run self-check, plus live account lookup when secrets exist
  • kody:@kody/twilio/account — slim account profile (never returns auth_token)
  • kody:@kody/twilio/incoming-numbers — incoming phone numbers
  • kody:@kody/twilio/messages — recent SMS/MMS logs
  • kody:@kody/twilio/send-message — preview or send; defaults to dry-run
  • kody:@kody/twilio/config — optional Messaging Service SID in packageStorage()
  • kody:@kody/twilio/request — escape hatch for other 2010-04-01 Account paths

Smoke test

./smoke-test is safe before anyone saves credentials: it returns { ok: true, live: false } and the setup URLs. After both secrets and host approval, invoke the package (not a static import) so Basic Auth placeholders resolve and account lookup runs:

import { packages } from 'kody:runtime'

export default async function main() {
	return await packages.invoke({
		kodyId: 'twilio',
		exportName: './smoke-test',
	})
}

A live result is account + one page of numbers and message logs. It does not send SMS.

Static overview (no secret mounts required):

import twilio from 'kody:@kody/twilio'

export default async function main() {
	return await twilio()
}

dryRun

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 sendMessage({
		to: '+15555550100',
		from: '+15555550101',
		body: 'Hello from Kody',
	})
}

That call previews. A live send after explicit user approval of the exact destination and body:

import sendMessage from 'kody:@kody/twilio/send-message'

export default async function main() {
	return sendMessage({
		to: '+15555550100',
		from: '+15555550101',
		body: 'Hello from Kody',
		confirm: true,
	})
}

Errors

Twilio responseWhat to do
401 AuthenticateSave twilioAccountSid and twilioAuthToken at the URLs above and approve api.twilio.com for both.
403The SID and token must belong to the same account.
404Confirm the Account SID and that the resource path exists.
400 missing FromPass from (E.164) or a Messaging Service SID. This package has no default sender.

Docs

Report this listing

Log in to report this listing.