> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# AI sidecar SWAIG tool webhook

POST 

Sent to a sidecar tool's `web_hook_url` (or the SWAIG `defaults.web_hook_url`) when the sidecar
calls one of your functions. Your endpoint runs the function and returns a JSON object with a
`response` string (the result the model reads next) and, optionally, an `action` — a single object
or an array — telling the sidecar what to do. See
[Supported SWAIG actions](/docs/swml/reference/calling/ai-sidecar#supported-swaig-actions) for what
you can return.

The sidecar only listens to the call and never speaks on it, so a `say` action is reported back to
you as a callback rather than being spoken aloud.

Reference: https://signalwire.com/docs/apis/rest/calls/webhooks/ai-sidecar-swaig-tool-webhook

## OpenAPI 3.1 Webhook Specification

```yaml
openapi: 3.1.0
info:
  title: signalwire-rest
  version: 1.0.0
paths: {}
webhooks:
  ai-sidecar-swaig-tool-webhook:
    post:
      operationId: ai-sidecar-swaig-tool-webhook
      summary: AI sidecar SWAIG tool webhook
      description: >-
        Sent to a sidecar tool's `web_hook_url` (or the SWAIG
        `defaults.web_hook_url`) when the sidecar

        calls one of your functions. Your endpoint runs the function and returns
        a JSON object with a

        `response` string (the result the model reads next) and, optionally, an
        `action` — a single object

        or an array — telling the sidecar what to do. See

        [Supported SWAIG
        actions](/docs/swml/reference/calling/ai-sidecar#supported-swaig-actions)
        for what

        you can return.


        The sidecar only listens to the call and never speaks on it, so a `say`
        action is reported back to

        you as a callback rather than being spoken aloud.
      responses:
        '200':
          description: Webhook received successfully
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                function:
                  type: string
                  description: The name of the function the model is calling.
                argument:
                  $ref: >-
                    #/components/schemas/WebhooksAiSidecarSwaigToolWebhookPayloadContentApplicationJsonSchemaArgument
                  description: The arguments the model passed to your function.
                call_id:
                  type: string
                  description: The ID of the call the sidecar is attached to.
                global_data:
                  $ref: >-
                    #/components/schemas/WebhooksAiSidecarSwaigToolWebhookPayloadContentApplicationJsonSchemaGlobalData
                  description: >-
                    The sidecar's current `global_data`. Present when the
                    sidecar has any.
                channel_data:
                  $ref: >-
                    #/components/schemas/WebhooksAiSidecarSwaigToolWebhookPayloadContentApplicationJsonSchemaChannelData
                  description: Call/channel context.
              required:
                - function
                - argument
                - call_id
                - channel_data
components:
  schemas:
    WebhooksAiSidecarSwaigToolWebhookPayloadContentApplicationJsonSchemaArgumentParsedItems:
      type: object
      properties: {}
      title: >-
        WebhooksAiSidecarSwaigToolWebhookPayloadContentApplicationJsonSchemaArgumentParsedItems
    WebhooksAiSidecarSwaigToolWebhookPayloadContentApplicationJsonSchemaArgument:
      type: object
      properties:
        parsed:
          type: array
          items:
            $ref: >-
              #/components/schemas/WebhooksAiSidecarSwaigToolWebhookPayloadContentApplicationJsonSchemaArgumentParsedItems
          description: The arguments parsed into objects. Usually a single-element array.
        raw:
          type: string
          description: The raw argument string, exactly as the model produced it.
        substituted:
          type: string
          description: The raw argument string after any variable substitution.
      required:
        - parsed
        - raw
        - substituted
      description: The arguments the model passed to your function.
      title: >-
        WebhooksAiSidecarSwaigToolWebhookPayloadContentApplicationJsonSchemaArgument
    WebhooksAiSidecarSwaigToolWebhookPayloadContentApplicationJsonSchemaGlobalData:
      type: object
      properties: {}
      description: The sidecar's current `global_data`. Present when the sidecar has any.
      title: >-
        WebhooksAiSidecarSwaigToolWebhookPayloadContentApplicationJsonSchemaGlobalData
    WebhooksAiSidecarSwaigToolWebhookPayloadContentApplicationJsonSchemaChannelData:
      type: object
      properties:
        call_id:
          type: string
          description: ID of the call.
        caller_id_name:
          type: string
          description: Caller ID name. Present when available.
        caller_id_number:
          type: string
          description: Caller ID number. Present when available.
        destination_number:
          type: string
          description: Destination number. Present when available.
      required:
        - call_id
      description: Call/channel context.
      title: >-
        WebhooksAiSidecarSwaigToolWebhookPayloadContentApplicationJsonSchemaChannelData

```