sms

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 12 Imported by: 0

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