twilio

package
v0.0.0-...-ddef314 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

templ: version: v0.3.1001

templ: version: v0.3.1001

Package twilio integrates Conway with Twilio for inbound SMS and voicemail.

It exposes signature-verified webhook endpoints that Twilio calls when a call or text comes in, persists each message to a unified inbox table, asynchronously downloads voicemail recordings, and serves an admin inbox UI for leadership users. All messages and their recordings are deleted after a configurable retention window (default 30 days).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AccountSid string `json:"account_sid" config:"label=Account SID,section=auth,help=From the Twilio console (Account Info). Starts with 'AC'."`
	AuthToken  string `` /* 164-byte string literal not displayed */

	VoiceGreeting        string `` /* 186-byte string literal not displayed */
	TranscriptionEnabled bool   `` /* 167-byte string literal not displayed */

	RetentionDays int `` /* 172-byte string literal not displayed */
}

Config is the persisted Twilio configuration.

AccountSid + AuthToken come from the Twilio console (https://console.twilio.com). The auth token is used both as the basic-auth password for downloading recordings and as the HMAC-SHA1 key Twilio uses to sign webhook requests, so it MUST be kept secret.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration before saving.

type Module

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

Module is the Twilio inbox module.

func New

func New(db *sql.DB, self *url.URL, eventLogger *engine.EventLogger) *Module

New constructs the module and applies its migration.

func (*Module) AttachRoutes

func (m *Module) AttachRoutes(router *engine.Router)

AttachRoutes registers public webhook routes and admin inbox routes.

func (*Module) AttachWorkers

func (m *Module) AttachWorkers(mgr *engine.ProcMgr)

AttachWorkers attaches the recording-downloader queue and the retention cleanup poll.

func (*Module) ConfigSpec

func (m *Module) ConfigSpec() config.Spec

ConfigSpec describes the Twilio configuration page in the admin UI.

func (*Module) GetItem

func (m *Module) GetItem(ctx context.Context) (downloadJob, error)

GetItem finds the next voicemail row whose recording hasn't been downloaded yet, respecting the per-row backoff schedule.

func (*Module) ProcessItem

func (m *Module) ProcessItem(ctx context.Context, job downloadJob) error

ProcessItem downloads the recording bytes from Twilio.

func (*Module) SetConfigLoader

func (m *Module) SetConfigLoader(store *config.Store)

SetConfigLoader wires up the typed config loader; called by the App after modules are registered with the config registry.

func (*Module) SetNavProvider

func (m *Module) SetNavProvider(fn func() []*admin.NavTab)

SetNavProvider supplies a callback that returns the current admin navbar tabs. The inbox pages render the same navbar as the rest of the admin UI.

func (*Module) UpdateItem

func (m *Module) UpdateItem(ctx context.Context, job downloadJob, success bool) error

UpdateItem records success/failure and schedules retries with capped exponential backoff.

Jump to

Keyboard shortcuts

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