curl --request POST \
--url https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"eventId": "id_123",
"eventName": "LeadSubmitted"
}
'import requests
url = "https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions"
payload = {
"eventId": "id_123",
"eventName": "LeadSubmitted"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({eventId: 'id_123', eventName: 'LeadSubmitted'})
};
fetch('https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'eventId' => 'id_123',
'eventName' => 'LeadSubmitted'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions"
payload := strings.NewReader("{\n \"eventId\": \"id_123\",\n \"eventName\": \"LeadSubmitted\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"eventId\": \"id_123\",\n \"eventName\": \"LeadSubmitted\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"eventId\": \"id_123\",\n \"eventName\": \"LeadSubmitted\"\n}"
response = http.request(request)
puts response.read_body{
"eventsFailed": 123,
"eventsReceived": 123,
"failures": [
{
"code": "<string>",
"eventId": "<string>",
"eventIndex": 123,
"message": "<string>",
"platformError": {}
}
],
"platform": "metaads",
"testCode": "<string>",
"traceId": "<string>"
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "<string>",
"retryable": true,
"type": "<string>"
}
}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:
LeadSubmittedQualifiedLeadPurchaseAddToCartInitiateCheckoutViewContentOrderCreatedOrderCanceledOrderReturned
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.
curl --request POST \
--url https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"eventId": "id_123",
"eventName": "LeadSubmitted"
}
'import requests
url = "https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions"
payload = {
"eventId": "id_123",
"eventName": "LeadSubmitted"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({eventId: 'id_123', eventName: 'LeadSubmitted'})
};
fetch('https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'eventId' => 'id_123',
'eventName' => 'LeadSubmitted'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions"
payload := strings.NewReader("{\n \"eventId\": \"id_123\",\n \"eventName\": \"LeadSubmitted\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"eventId\": \"id_123\",\n \"eventName\": \"LeadSubmitted\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"eventId\": \"id_123\",\n \"eventName\": \"LeadSubmitted\"\n}"
response = http.request(request)
puts response.read_body{
"eventsFailed": 123,
"eventsReceived": 123,
"failures": [
{
"code": "<string>",
"eventId": "<string>",
"eventIndex": 123,
"message": "<string>",
"platformError": {}
}
],
"platform": "metaads",
"testCode": "<string>",
"traceId": "<string>"
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "<string>",
"retryable": true,
"type": "<string>"
}
}请求规范
- 方法与路径: POST /apis/v1/social/messaging/whatsapp/conversions
- 可用状态: enabled
- 请求 URL 模板:
https://api.aisa.one/apis/v1/social/messaging/whatsapp/conversions - connectionId: query; 必填
{
"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"
}
}
}
}
费用与请求规则
此操作不另收费。授权
查询参数
请求体
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.
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.
LeadSubmitted, QualifiedLead, Purchase, AddToCart, InitiateCheckout, ViewContent, OrderCreated, OrderCanceled, OrderReturned 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.
响应
Success