> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tetherai.ca/llms.txt
> Use this file to discover all available pages before exploring further.

# Handle inbound SMS webhook (Twilio)

> Inbound webhook called by Twilio when an SMS or MMS is delivered to a Tether-provisioned Twilio number. Persists the message and any attached media, drives automation/AI replies, and responds with empty TwiML.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/webhook/twilio/sms
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/webhook/twilio/sms:
    post:
      tags:
        - Webhooks
      summary: Handle inbound SMS webhook (Twilio)
      description: >-
        Inbound webhook called by Twilio when an SMS or MMS is delivered to a
        Tether-provisioned Twilio number. Persists the message and any attached
        media, drives automation/AI replies, and responds with empty TwiML.
      operationId: post_webhook_twilio_sms
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TwilioInboundSmsRequest'
      responses:
        '200':
          description: >-
            Empty TwiML response acknowledging receipt. Tether handles
            persistence + automation server-side; Twilio expects empty TwiML.
          content:
            application/xml:
              schema:
                type: string
              example: <?xml version="1.0" encoding="UTF-8"?><Response></Response>
        '500':
          description: Webhook processing failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookErrorResponse'
components:
  schemas:
    TwilioInboundSmsRequest:
      type: object
      properties:
        From:
          type: string
          description: Sender phone number in E.164 (e.g. `+14165550100`).
        To:
          type: string
          description: Tether-provisioned Twilio number that received the message.
        Body:
          type: string
          description: SMS/MMS text content.
        MessageSid:
          type: string
          description: Twilio-assigned message identifier (`SM…` for SMS, `MM…` for MMS).
        NumMedia:
          type: string
          description: Count of attached media items as a string; `0` for plain SMS.
        MediaUrl0:
          type: string
          description: >-
            URL of the first media attachment (Twilio CDN); additional
            `MediaUrlN` fields appear when NumMedia > 1.
        MediaContentType0:
          type: string
          description: MIME type of the first media attachment, e.g. `image/jpeg`.
      additionalProperties: true
      example:
        From: '+14165550100'
        To: '+12362320246'
        Body: Hey, can you call me back?
        MessageSid: SM5f7b1c2e8a1d4e0012c3b4a5
        NumMedia: '0'
    WebhookErrorResponse:
      type: object
      description: >-
        Error envelope used across provider webhook routes. Most failures only
        carry `error`; a few (ElevenLabs tool errors, ingress validation) add
        `success:false`, `message`, or a `code`. Many of these endpoints respond
        200 with `success:false` for recoverable cases (especially the
        ElevenLabs server tools) — only hard failures use 4xx/5xx.
      properties:
        error:
          type: string
        message:
          type: string
        success:
          type: boolean
          enum:
            - false
        code:
          type: string
        details:
          description: Optional diagnostic detail (stack snippet, validation issues, etc.).
      additionalProperties: true
      example:
        error: Webhook processing failed

````