DEV Community

Aleksander Sekowski
Aleksander Sekowski

Posted on Originally published at pixellint.org

OpenAI CAPI is not Meta with a new host

The ads conversion POST looks familiar until you count the digits and read the field names. OpenAI Ads uses a different path, a different clock, and a different id than Meta CAPI. A shared worker that only knows event_time will 200 and still miss.

Different path, different envelope

Meta CAPI posts to the Graph API events edge. The body is data[] of events, each with event_name, event_time, action_source, user_data. OpenAI Ads Conversions API posts to bzr.openai.com/v1/events. The body is events[], each with id, type, and timestamp_ms. The image pixel is yet another path: /v1/sdk/events with pid.

Pixellint pack vendor/openai-conversions-api is the server hop. vendor/openai is the image tag. They are not aliases.

timestamp_ms is 13 digits

OpenAI timestamp_ms is Unix milliseconds. Date.now() is already 13 digits. Meta event_time is Unix seconds, 10 digits, so the Meta helper is Math.floor(Date.now() / 1000). Sending that 10-digit value as timestamp_ms is too short. Pixellint flags vendor.openai-conversions-api.body.timestamp_ms.invalid.

{
  "events": [
    {
      "type": "order_created",
      "timestamp_ms": 1770000000
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

id is not event_id

OpenAI events[].id is required. Meta event_id is how you dedup the pixel against CAPI. Same idea, different key. type is an OpenAI event type such as order_created. Meta event_name is Purchase. Web events also need source_url.

The adapter is the product

Store one UTC instant. Convert at the edge: floor(ms/1000) for Meta, Date.now() for OpenAI. Run pixellint validate json --rulepack vendor/openai-conversions-api on the body you POST to bzr.openai.com. One fixture cannot serve both.

Pixellint is not affiliated with OpenAI or Meta. Playground: pixellint.org. Pack: OpenAI Conversions API.

Original: OpenAI CAPI is not Meta with a new host

Top comments (0)