sms

package
v0.54.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sms is the gateway's SMS adapter over Twilio: inbound messages arrive as form-encoded webhooks (signature-verified), replies go out through the Messages API. SMS is the tactical lane — alerts, approvals, short tasks from a phone — not a long-form chat surface. A2P registration (US 10DLC) is the operator's responsibility with Twilio.

Signature validation needs the EXACT public URL Twilio posts to (scheme, host, path — byte for byte), which a proxied server can't reliably reconstruct, so it is explicit config: sms.webhook_url in gateway.yaml.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	// contains filtered or unexported fields
}

Channel is a Twilio SMS connection.

func New

func New(accountSID, authToken, from, webhookURL, mediaDir string) *Channel

New builds an SMS channel. webhookURL must be the exact public URL configured on the Twilio number; with it empty the handler rejects everything (fail closed — unsigned/unverifiable inbound SMS is never delivered).

func (*Channel) Handler

func (c *Channel) Handler(sink channels.Sink) http.Handler

Handler returns the inbound webhook handler. Twilio signs each request with HMAC-SHA1 over the exact URL plus the sorted form params; a request that doesn't verify is rejected before anything is parsed.

func (*Channel) Name

func (c *Channel) Name() string

Name returns the adapter identifier.

func (*Channel) Send

func (c *Channel) Send(ctx context.Context, conversation string, msg channels.Outbound) error

Send posts a reply through the Messages API, split with the shared chunker.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL