Send a Conversion to Meta
Report to Meta that a conversation which started from one of your Click-to-WhatsApp ads turned into a lead or a sale. Meta receives it through its Conversions API for business messaging, so Ads Manager and Events Manager show which ads bring leads and customers, and Meta can optimize your campaigns for them.
Use it from your own system, your CRM or an automation tool (Zapier, Make, n8nโฆ) when something happens outside 2Chat: for example, when a lead becomes a customer. You only send the two phone numbers and the event: 2Chat already keeps the ad's click ID (ctwa_clid) from the person's first message and sends it to Meta for you.
- A WhatsApp Business API (WABA) number connected straight to Meta from 2Chat, including numbers that also keep using the WhatsApp Business app (coexistence).
- Conversions turned on for that number: open the number in the webapp, go to its Conversions tab and click Connect with Meta.
Step by step: How to send leads and sales from your Click-to-WhatsApp ads to Meta.
How events are reportedโ
- Only conversations that started from an ad. The person has to have written to your number by tapping a Click-to-WhatsApp ad. Conversations that started any other way answer
skippedwithno_ad_click, and so do ads shown in WhatsApp Status, because Meta doesn't send a click ID for them. - Up to 7 days after the click. Meta takes events for 7 days from the last time the person wrote to you from the ad. After that the answer is
click_expired. - Once per click and event. Each
event_nameis reported once for each ad click. You can reportLeadSubmittedand laterPurchasefor the same conversation, but sendingPurchasetwice answersalready_sentthe second time. - No amount. Events go to Meta without a value or currency. The event time is the moment of your call.
- In the background.
queuedmeans 2Chat registered the event and is sending it to Meta, so the call doesn't wait for Meta. The number's Conversions tab in the webapp lists the latest events and whether Meta accepted them.
Tags can report the same events. Give a tag a Meta rule in the webapp, and when that tag is added to a conversation that came from an ad (from the live chat, a flow or the Add Tag to Conversation endpoint), 2Chat reports its event, with the same once-per-click rule. Adding a tag the conversation already has reports nothing. This endpoint is for when you only have the phone numbers.
Endpointโ
POST https://api.p.2chat.io/open/waba/conversions
Authenticationโ
Send your API key in the X-User-API-Key header. See Authentication.
API costโ
Each call to this endpoint deducts 0 API credits from your plan's API credit pool.
Reporting conversions is free: this endpoint doesn't consume API credits.
Parametersโ
Send them as a JSON body.
| Parameter | Description | Example |
|---|---|---|
from_number | Your WABA number, in E.164 format. The leading + is optional. Required. | +15550001111 |
to_number | The phone number of the person you are talking to, in E.164 format, as WhatsApp reports it (the remote_phone_number of the webhooks). The leading + is optional. For Brazilian numbers, both forms work, with or without the ninth digit. Argentine mobile numbers need the 9 after +54 (+549โฆ): without it the conversation isn't found. Required. | +15552223333 |
event_name | What happened in the conversation: LeadSubmitted, QualifiedLead or Purchase (see below). Required. | Purchase |
event_name | Use it when |
|---|---|
LeadSubmitted | The person is a lead: they asked for a price, left their details or showed interest |
QualifiedLead | The lead is qualified: for example, they fit your offer or booked a call |
Purchase | The person bought from you or became a customer |
Invocationโ
- cURL
- Python
- JavaScript
- PHP
curl --location --request POST 'https://api.p.2chat.io/open/waba/conversions' \
--header 'X-User-API-Key: your_api_key_here' \
--header 'Content-Type: application/json' \
--data '{
"from_number": "+15550001111",
"to_number": "+15552223333",
"event_name": "Purchase"
}'
import requests
url = "https://api.p.2chat.io/open/waba/conversions"
headers = {
"X-User-API-Key": "your_api_key_here",
"Content-Type": "application/json"
}
payload = {
"from_number": "+15550001111",
"to_number": "+15552223333",
"event_name": "Purchase"
}
response = requests.post(url, headers=headers, json=payload)
result = response.json()
if result.get("success") and result["data"]["status"] == "queued":
print("Sent to Meta")
elif result.get("success"):
print("Not sent:", result["data"]["reason"])
else:
# Endpoint errors come in `error_message`; authentication and validation errors in `detail`
print("Error", response.status_code, result.get("error_message") or result.get("detail"))
const axios = require('axios');
axios.post('https://api.p.2chat.io/open/waba/conversions', {
from_number: '+15550001111',
to_number: '+15552223333',
event_name: 'Purchase'
}, {
headers: {
'X-User-API-Key': 'your_api_key_here',
'Content-Type': 'application/json'
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error.response ? error.response.data : error));
<?php
$ch = curl_init('https://api.p.2chat.io/open/waba/conversions');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-User-API-Key: your_api_key_here',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'from_number' => '+15550001111',
'to_number' => '+15552223333',
'event_name' => 'Purchase'
]));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Responseโ
The event was registered and is being sent to Meta:
{
"success": true,
"data": {
"status": "queued",
"reason": null
}
}
Nothing was sent, with the reason. It is still a 200, so check data.status:
{
"success": true,
"data": {
"status": "skipped",
"reason": "no_ad_click"
}
}
| Field | Description |
|---|---|
success | true when the request was valid |
data.status | queued: 2Chat is sending the event to Meta. skipped: nothing was sent, see reason |
data.reason | null when queued. When skipped, one of the reasons below |
reason | Why nothing was sent |
|---|---|
not_meta_channel | from_number isn't connected straight to Meta, so it can't report conversions |
no_ad_click | The conversation with to_number didn't start from a Click-to-WhatsApp ad, there is no conversation with that number, or the ad was shown in WhatsApp Status. Also when the contact hides their number from you (see the note below) |
channel_disabled | Conversions are turned off for from_number. Turn them on in the number's Conversions tab |
click_expired | More than 7 days went by since the person last wrote to you from the ad |
already_sent | This event_name was already reported for this ad click. It isn't sent again, even if Meta refused it the first time |
When a contact hides their phone number from you, their conversation has only a WhatsApp user ID (the remote_id of the webhooks, like CO.4815162342108421), and this endpoint can't find it by phone: it answers no_ad_click even if they came from an ad. To report those conversations, add a tag with a Meta rule instead.
Error responsesโ
Errors return a 4xx status. Errors from the endpoint itself come in this shape:
{
"error": true,
"error_message": "Payload is invalid: `event_name` must be one of LeadSubmitted, QualifiedLead, Purchase"
}
Authentication errors and missing body parameters come with a detail field instead, as the table shows:
{
"detail": "Invalid API Key"
}
| Status | Body | When |
|---|---|---|
400 | error_message: Payload is invalid: `event_name` must be one of LeadSubmitted, QualifiedLead, Purchase | event_name isn't one of the three events |
400 | error_message: Payload is invalid: to_number is not valid or not in international format: [...] (or from_number) | from_number or to_number isn't a valid number in international format |
401 | {"detail": "Invalid API Key"} | The API key doesn't exist |
402 | {"detail": "Account Expired. Please check your Billing Portal."} | Your account's plan has expired |
403 | {"detail": "Not authenticated"} | The request has no X-User-API-Key header |
403 | {"detail": "API key is no longer active"} | The API key was deactivated |
404 | error_message: WhatsApp Profile setup not found | from_number isn't a WABA number of your account |
422 | {"detail": [{"loc": ["body", "event_name"], "msg": "field required", ...}]} | A body parameter is missing |
Typical flowโ
- Someone taps your Click-to-WhatsApp ad and writes to your WABA number. 2Chat keeps the ad and its click ID with the conversation (you can see them in the
whatsapp.waba.message.receivedwebhook). - When the person becomes a lead or a customer in your system, call this endpoint with your number, theirs and the event, within 7 days of the click.
- If
data.statusisskipped,data.reasontells you why. To see how many conversations each ad started, use the Ads Report.
From Zapier, Make or n8n: use their HTTP step (in Zapier, Webhooks by Zapier โบ POST or Custom Request) with the URL above, the X-User-API-Key header and the three body parameters as JSON.