FabricFabricHarness
EcosystemChannels

Twilio

Connect messaging and voice events to Fabric agents.

Use the messaging adapter from @fabric-harness/channels/twilio:

fh add channel twilio
import { createTwilioChannel } from '@fabric-harness/channels/twilio';

export default createTwilioChannel({
  accountSid: process.env.TWILIO_ACCOUNT_SID!,
  authToken: process.env.TWILIO_AUTH_TOKEN!,
  webhookUrl: process.env.TWILIO_WEBHOOK_URL!,
  agent: 'assistant',
  tenantId: 'acme',
});

Mount POST /channels/twilio/messages. webhookUrl must be the exact public URL configured in Twilio when a proxy rewrites the internal request URL. The adapter validates X-Twilio-Signature with HMAC-SHA1 over the URL and sorted form parameters, deduplicates by Message SID, records the sender as actor, and distinguishes SMS from whatsapp: addresses.

Use replyWithTwilio(ref, { authToken }) for outbound SMS or Twilio WhatsApp messages.

For Media Streams also follow the voice-telephony connector specification. Gate outbound calls, transfers, and recordings separately and apply phone-number/recording privacy controls.