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

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# Send WhatsApp conversion event

> WhatsApp. Forward a WhatsApp Business Messaging conversion event to Meta's Conversions API with `action_source = business_messaging` and `messaging_channel = whatsapp`.

Supported events:

- `LeadSubmitted`
- `QualifiedLead`
- `Purchase`
- `AddToCart`
- `InitiateCheckout`
- `ViewContent`
- `OrderCreated`
- `OrderCanceled`
- `OrderReturned`

The endpoint looks up the originating CTWA click ID (`ctwa_clid`) captured on the first inbound message of the conversation. It replays it on every event so Meta can attribute the conversion back to the Click-to-WhatsApp ad that drove the chat.

Identify the conversation by phoneE164 (digits only, no +): the most recent ad-attributed conversation of that phone on the connection is used.

A write: needs messaging:write and is audited.

## 请求规范

* **方法与路径:** POST /apis/v1/social/messaging/whatsapp/conversions
* **可用状态:** enabled
* **请求 URL 模板:** `https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions`
* **connectionId:** query; 必填

[完整 OpenAPI 定义](https://aisa.one/docs/openapi/zh/aisa-messaging.json)

有效请求声明（包括认证和引用的 schema）：

```json theme={null}
{
  "operationId": "post_aisa_messaging_apis_v1_social_messaging_what_cea3ba",
  "method": "POST",
  "path": "/apis/v1/social/messaging/whatsapp/conversions",
  "servers": [
    {
      "url": "https://api.aisa.one"
    }
  ],
  "parameters": [
    {
      "description": "Your messaging connection (msc_...), from GET /apis/v1/social/messaging/connections. On a request with a JSON body it may be sent as a top-level body member instead.",
      "in": "query",
      "name": "connectionId",
      "required": true,
      "schema": {
        "pattern": "^msc_[0-9A-Za-z]+$",
        "type": "string"
      }
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "example": {
          "eventId": "id_123",
          "eventName": "LeadSubmitted"
        },
        "schema": {
          "additionalProperties": false,
          "description": "In addition to the `required` list, at least one of\n`conversationId` or `phoneE164` must be supplied (used to\nresolve the originating CTWA conversation). The route enforces\nthis at the Zod boundary; OpenAPI's `required` cannot express\nOR-required cleanly.",
          "properties": {
            "connectionId": {
              "description": "The connection, when not sent as the connectionId query parameter.",
              "pattern": "^msc_[0-9A-Za-z]+$",
              "type": "string"
            },
            "contentIds": {
              "description": "Optional product / content identifiers.",
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "currency": {
              "description": "ISO 4217 currency code (e.g. `USD`).",
              "maxLength": 3,
              "minLength": 3,
              "type": "string"
            },
            "email": {
              "description": "User email. Normalized + SHA-256 hashed before sending to Meta.",
              "format": "email",
              "type": "string"
            },
            "eventId": {
              "description": "Stable dedup key. Reuse to suppress duplicate events\n(Meta dedupes against pixel events with the same id).",
              "minLength": 1,
              "type": "string"
            },
            "eventName": {
              "description": "Event names accepted by Meta's CAPI for Business\nMessaging. Other standard pixel events including `Lead`,\n`CompleteRegistration`, `Subscribe`, `Schedule`, `Contact`,\n`StartTrial`, `AddPaymentInfo`, `Search`, and\n`SubmitApplication` are rejected with subcode 2804066\n(\"Messaging Event Invalid Event Type\") on\n`action_source = business_messaging` events. Custom event\nnames are also rejected.\n\nUse `LeadSubmitted` (NOT `Lead`) when a lead comes in and\n`QualifiedLead` once your team qualifies it.",
              "enum": [
                "LeadSubmitted",
                "QualifiedLead",
                "Purchase",
                "AddToCart",
                "InitiateCheckout",
                "ViewContent",
                "OrderCreated",
                "OrderCanceled",
                "OrderReturned"
              ],
              "type": "string"
            },
            "eventTime": {
              "description": "Unix seconds. Defaults to the time of the request when\nomitted. Meta's attribution window is 7 days from click;\nevents older than that lose attribution.",
              "type": "number"
            },
            "externalId": {
              "description": "Stable customer identifier. Lowercased + SHA-256 hashed\nbefore sending to Meta.",
              "type": "string"
            },
            "phoneE164": {
              "description": "Contact phone number, digits only with no '+'. When used\nin lieu of `conversationId`, the handler resolves to the\nmost recent CTWA-attributed conversation for this phone\non the supplied account.",
              "minLength": 1,
              "type": "string"
            },
            "testCode": {
              "description": "Meta `test_event_code` passthrough, sent at the request root\n(a root-level `test_event_code` is accepted as an alias). The\nevent shows in Events Manager's Test Events tab for the\ndataset whose current test code matches. Meta still\nprocesses it like any other event, so remove it in production.",
              "type": "string"
            },
            "value": {
              "description": "Conversion value (e.g. order total).",
              "type": "number"
            }
          },
          "required": [
            "eventName",
            "eventId"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "x-aisa-status": "enabled",
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
```

## 费用与请求规则

此操作不另收费。


## OpenAPI

````yaml openapi/zh/aisa-messaging.json POST /apis/v1/social/messaging/whatsapp/conversions
openapi: 3.1.0
info:
  description: ''
  title: AIsa Messaging
  version: '1'
  x-aisa-capabilities:
    idempotency: Idempotency-Key
    max_price: X-AISA-Max-Price-USD
    quote:
      header: X-AISA-Cost-Mode
      value: quote
  x-aisa-catalogs:
    aisa-messaging:
      description: ''
      title: AIsa Messaging
      x-aisa-capabilities:
        idempotency: Idempotency-Key
        max_price: X-AISA-Max-Price-USD
        quote:
          header: X-AISA-Cost-Mode
          value: quote
      x-aisa-document:
        facts_hash: 3f75dbfba86cc5ac46b20ee9310446322890eeeb034619f5c221a47d6b1064a2
        generator_version: '3'
        protocol_version: '1'
        schema_version: '1'
      x-aisa-plans:
        builder: 1
        display_plan: payg
        payg: 1
        similarweb_payg: 1
        team: 1
        version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-configured-paths: []
  x-aisa-document:
    composer_version: '31'
    document_hash: sha256:989b0c03378fa66fa7653d6c34e54850322e6be4bc7d9f0f130ac18a459676eb
    facts_hash: 3f75dbfba86cc5ac46b20ee9310446322890eeeb034619f5c221a47d6b1064a2
    generator_version: '3'
    protocol_version: '1'
    response_pending: []
    schema_version: '1'
  x-aisa-plans:
    builder: 1
    display_plan: payg
    payg: 1
    similarweb_payg: 1
    team: 1
    version: e70a0959cd1b93b84ae16dffd7a538273ddb9c1d46277b82823c37ff1b6bc0fb
  x-aisa-provider: aisa-messaging
servers:
  - url: https://api.aisa.one
security:
  - bearerAuth: []
paths:
  /apis/v1/social/messaging/whatsapp/conversions:
    post:
      summary: Send WhatsApp conversion event
      description: >-
        WhatsApp. Forward a WhatsApp Business Messaging conversion event to
        Meta's Conversions API with `action_source = business_messaging` and
        `messaging_channel = whatsapp`.


        Supported events:


        - `LeadSubmitted`

        - `QualifiedLead`

        - `Purchase`

        - `AddToCart`

        - `InitiateCheckout`

        - `ViewContent`

        - `OrderCreated`

        - `OrderCanceled`

        - `OrderReturned`


        The endpoint looks up the originating CTWA click ID (`ctwa_clid`)
        captured on the first inbound message of the conversation. It replays it
        on every event so Meta can attribute the conversion back to the
        Click-to-WhatsApp ad that drove the chat.


        Identify the conversation by phoneE164 (digits only, no +): the most
        recent ad-attributed conversation of that phone on the connection is
        used.


        A write: needs messaging:write and is audited.
      operationId: post_aisa_messaging_apis_v1_social_messaging_what_cea3ba
      parameters:
        - description: >-
            Your messaging connection (msc_...), from GET
            /apis/v1/social/messaging/connections. On a request with a JSON body
            it may be sent as a top-level body member instead.
          in: query
          name: connectionId
          required: true
          schema:
            pattern: ^msc_[0-9A-Za-z]+$
            type: string
      requestBody:
        content:
          application/json:
            example:
              eventId: id_123
              eventName: LeadSubmitted
            schema:
              additionalProperties: false
              description: |-
                In addition to the `required` list, at least one of
                `conversationId` or `phoneE164` must be supplied (used to
                resolve the originating CTWA conversation). The route enforces
                this at the Zod boundary; OpenAPI's `required` cannot express
                OR-required cleanly.
              properties:
                connectionId:
                  description: >-
                    The connection, when not sent as the connectionId query
                    parameter.
                  pattern: ^msc_[0-9A-Za-z]+$
                  type: string
                contentIds:
                  description: Optional product / content identifiers.
                  items:
                    type: string
                  type: array
                currency:
                  description: ISO 4217 currency code (e.g. `USD`).
                  maxLength: 3
                  minLength: 3
                  type: string
                email:
                  description: >-
                    User email. Normalized + SHA-256 hashed before sending to
                    Meta.
                  format: email
                  type: string
                eventId:
                  description: |-
                    Stable dedup key. Reuse to suppress duplicate events
                    (Meta dedupes against pixel events with the same id).
                  minLength: 1
                  type: string
                eventName:
                  description: |-
                    Event names accepted by Meta's CAPI for Business
                    Messaging. Other standard pixel events including `Lead`,
                    `CompleteRegistration`, `Subscribe`, `Schedule`, `Contact`,
                    `StartTrial`, `AddPaymentInfo`, `Search`, and
                    `SubmitApplication` are rejected with subcode 2804066
                    ("Messaging Event Invalid Event Type") on
                    `action_source = business_messaging` events. Custom event
                    names are also rejected.

                    Use `LeadSubmitted` (NOT `Lead`) when a lead comes in and
                    `QualifiedLead` once your team qualifies it.
                  enum:
                    - LeadSubmitted
                    - QualifiedLead
                    - Purchase
                    - AddToCart
                    - InitiateCheckout
                    - ViewContent
                    - OrderCreated
                    - OrderCanceled
                    - OrderReturned
                  type: string
                eventTime:
                  description: |-
                    Unix seconds. Defaults to the time of the request when
                    omitted. Meta's attribution window is 7 days from click;
                    events older than that lose attribution.
                  type: number
                externalId:
                  description: |-
                    Stable customer identifier. Lowercased + SHA-256 hashed
                    before sending to Meta.
                  type: string
                phoneE164:
                  description: |-
                    Contact phone number, digits only with no '+'. When used
                    in lieu of `conversationId`, the handler resolves to the
                    most recent CTWA-attributed conversation for this phone
                    on the supplied account.
                  minLength: 1
                  type: string
                testCode:
                  description: >-
                    Meta `test_event_code` passthrough, sent at the request root

                    (a root-level `test_event_code` is accepted as an alias).
                    The

                    event shows in Events Manager's Test Events tab for the

                    dataset whose current test code matches. Meta still

                    processes it like any other event, so remove it in
                    production.
                  type: string
                value:
                  description: Conversion value (e.g. order total).
                  type: number
              required:
                - eventName
                - eventId
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  eventsFailed:
                    description: Events rejected by Meta (see failures).
                    type: integer
                  eventsReceived:
                    description: Events accepted by Meta.
                    type: integer
                  failures:
                    description: |-
                      Per-event failure detail. Empty when all events were
                      accepted.
                    items:
                      properties:
                        code:
                          oneOf:
                            - type: string
                            - type: integer
                        eventId:
                          description: Echoes back the eventId of the failed event.
                          type: string
                        eventIndex:
                          description: Index into the submitted events array.
                          type: integer
                        message:
                          type: string
                        platformError:
                          additionalProperties: true
                          description: >-
                            Meta's own error for the rejected event, with
                            credentials redacted:

                            `message`, `type`, `code`, `error_subcode`,
                            `error_user_title`,

                            `error_user_msg` and `fbtrace_id` when Meta sends
                            them. `message` above

                            already ends with `error_user_msg`. Absent when Meta
                            returned no error body.
                          type: object
                      type: object
                    type: array
                  platform:
                    enum:
                      - metaads
                    type: string
                  testCode:
                    description: >-
                      The test code sent to Meta, or `null` when the request
                      carried none.
                    type:
                      - string
                      - 'null'
                  traceId:
                    description: |-
                      Meta `fbtrace_id` for debugging. Surface in support
                      tickets.
                    type: string
                type: object
          description: Success
        default:
          content:
            application/json:
              schema:
                properties:
                  error:
                    properties:
                      code:
                        type:
                          - string
                          - 'null'
                      details:
                        additionalProperties: {}
                        type:
                          - object
                          - 'null'
                      message:
                        type:
                          - string
                          - 'null'
                      param:
                        type:
                          - string
                          - 'null'
                      retryHint:
                        type:
                          - string
                          - 'null'
                      retryable:
                        type:
                          - boolean
                          - 'null'
                      type:
                        type:
                          - string
                          - 'null'
                    type:
                      - object
                      - 'null'
                type: object
          description: Error. The code field is stable; see the error catalog.
components:
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.