# Send WhatsApp conversion event

Sends a WhatsApp conversion event.

```http
POST https://api.pozy.ai/v1/whatsapp/conversions
```

- Area: WhatsApp / WhatsApp
- Auth: Authorization: Bearer pz_live_...

## Request body

Content type: `application/json`

- `accountId`, string, required
- `eventName`, string, required: One of `LeadSubmitted`, `QualifiedLead`, `Purchase`, `AddToCart`, `InitiateCheckout`, `ViewContent`, `OrderCreated`, `OrderCanceled`, `OrderReturned`
- `eventTime`, number
- `eventId`, string, required
- `conversationId`, string
- `phoneE164`, string
- `value`, number
- `currency`, string: 3 to 3 characters
- `contentIds`, array of string
- `email`, string (email)
- `externalId`, string
- `testCode`, string

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/whatsapp/conversions" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "accountId": "696e0b682d0a31188e7a2ba9",
  "eventName": "LeadSubmitted",
  "eventId": "60c89d0a2e8d4a8ebed77064"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/whatsapp/conversions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    accountId: "696e0b682d0a31188e7a2ba9",
    eventName: "LeadSubmitted",
    eventId: "60c89d0a2e8d4a8ebed77064"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.post(
    "https://api.pozy.ai/v1/whatsapp/conversions",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "accountId": "696e0b682d0a31188e7a2ba9",
        "eventName": "LeadSubmitted",
        "eventId": "60c89d0a2e8d4a8ebed77064",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `platform`, string: One of `metaads`
- `eventsReceived`, integer
- `eventsFailed`, integer
- `failures`, array of object
  - `eventIndex`, integer
  - `eventId`, string
  - `message`, string
  - `code`, string or integer
  - `platformError`, object
- `traceId`, string
- `testCode`, string: Can be null

```json
{
  "platform": "metaads",
  "eventsReceived": 1,
  "eventsFailed": 1,
  "failures": [
    {
      "eventIndex": 1,
      "eventId": "60c89d0a2e8d4a8ebed77064",
      "message": "Hello from Pozy",
      "code": "string",
      "platformError": {}
    }
  ],
  "traceId": "6aa41aeffa864e6ffa88403d",
  "testCode": "string"
}
```
