> Part of the walkerOS documentation. Project overview and full index: <https://www.walkeros.io/llms.txt>

# OpenAI Ads Conversions API

[Server](#)[ Source code](https://github.com/elbwalker/walkerOS/tree/main/packages/server/destinations/openai-ads)[ Package](https://www.npmjs.com/package/@walkeros/server-destination-openai-ads) Beta

Server-side conversions to the OpenAI Ads Conversions API, the conversion endpoint of ads in ChatGPT.

Where this fits

OpenAI Ads Conversions API is a **server destination** in the walkerOS flow:

Sends one event per request to `POST https://bzr.openai.com/v1/events?pid=<pixelId>` with the Conversions API key as Bearer token, using raw HTTP (no SDK). Every request names walkerOS as its `integration_source`, as OpenAI asks integrations to. Email, phone, external id and names are normalised and SHA-256 hashed before sending.

## Installation[​](#installation "Direct link to Installation")

```bash
npm install @walkeros/collector @walkeros/server-destination-openai-ads
```

* Integrated
* Bundled

```typescript
import { startFlow } from '@walkeros/collector';
import destinationOpenaiAds from '@walkeros/server-destination-openai-ads';

await startFlow({
  destinations: {
    openaiAds: {
      code: destinationOpenaiAds,
      config: {
        settings: {
          apiKey: process.env.OPENAI_CONVERSIONS_API_KEY,
          pixelId: 'px_abc123',
        },
      },
    },
  },
});
```

A complete `flow.json` with this destination:

```json
{
  "version": 4,
  "flows": {
    "default": {
      "config": {
        "platform": "server"
      },
      "destinations": {
        "openaiAds": {
          "package": "@walkeros/server-destination-openai-ads",
          "config": {
            "settings": {
              "apiKey": "$secret.OPENAI_CONVERSIONS_API_KEY",
              "pixelId": "px_abc123"
            }
          }
        }
      }
    }
  }
}
```

[See bundled mode setup](https://www.walkeros.io/docs/getting-started/modes/bundled.md) | [CLI reference](https://www.walkeros.io/docs/apps/cli.md)

The `apiKey` is the Conversions API key from the conversions tab in Ads Manager, not the Advertiser API key.

## Configuration[​](#configuration "Direct link to Configuration")

This destination uses the standard destination config wrapper (consent, data, env, id, ...). For the shared fields see [destination configuration](https://www.walkeros.io/docs/destinations.md#configuration). Package-specific fields live under `config.settings` and are listed below.

## Settings[​](#settings "Direct link to Settings")

| Property        | Type                               | Description                                                                                                                                                                                           | More |
| --------------- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- |
| `apiKey*`       | `string`                           | Conversions API key from Ads Manager > Conversions (not the Advertiser API key), sent as Bearer token                                                                                                 |      |
| `pixelId*`      | `string`                           | Pixel ID of the web data source, sent as the pid query parameter                                                                                                                                      |      |
| `action_source` | `'web' \| 'mobile_app' \| 'offlin` | Where the conversion happened: web, mobile\_app, offline, physical\_store, phone\_call, email or other. Default: web. A web event needs a source URL. An action\_source mapped in the rule data wins. |      |
| `validate_only` | `boolean`                          | true: OpenAI validates each request and records nothing; validated events do not show in event monitoring                                                                                             |      |
| `doNotHash`     | `Array<'email' \| 'phone' \| 'ext` | Keys sent as mapped, without normalizing and hashing: their values must already be SHA-256 digests                                                                                                    |      |
| `ip`            | `any \| boolean`                   | Client IP, sent as user.ip\_address. Resolves against { ingest, event }. Default: \["ingest.ip", "event.user.ip"]. false switches it off. A mapped ip\_address wins.                                  |      |
| `userAgent`     | `any \| boolean`                   | Client user agent, sent as user.user\_agent. Resolves against { ingest, event }. Default: \["ingest.userAgent", "event.user.userAgent"]. false switches it off. A mapped user\_agent wins.            |      |

\* Required fields

## Mapping[​](#mapping "Direct link to Mapping")

This package does not define custom rule-level settings. For the standard rule fields (consent, condition, data, batch, name, policy) see [mapping](https://www.walkeros.io/docs/mapping.md).

## Examples

### App install

An app install is sent as app\_installed with action\_source mobile\_app, mapped per event, and the Android advertising id.

Event

```json
{
  "name": "app install",
  "data": {
    "gaid": "38400000-8cf0-11bd-b23e-10b96e40000d"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "lang": "elb"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "app_installed_123",
  "trigger": "test",
  "entity": "app",
  "action": "install",
  "timestamp": 1700000905000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "express",
    "platform": "server"
  }
}
```

Mapping

```json
{
  "name": "app_installed",
  "data": {
    "map": {
      "action_source": {
        "value": "mobile_app"
      },
      "android_advertising_id": "data.gaid"
    }
  }
}
```

Out

```javascript
sendServer("https://bzr.openai.com/v1/events?pid=px_abc123", "{\"integration_source\":\"walkeros\",\"events\":[{\"id\":\"app_installed_123\",\"type\":\"app_installed\",\"timestamp_ms\":1700000905000,\"action_source\":\"mobile_app\",\"user\":{\"android_advertising_id\":\"38400000-8cf0-11bd-b23e-10b96e40000d\"},\"data\":{\"type\":\"customer_action\"}}]}", {
  "headers": {
    "Authorization": "Bearer s3cr3t",
    "Content-Type": "application/json"
  }
})
```

### Custom event

A rule name that is not a standard type is sent as a custom event with that name.

Event

```json
{
  "name": "demo booked",
  "data": {},
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "lang": "elb"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "ev-1700000904",
  "trigger": "test",
  "entity": "demo",
  "action": "booked",
  "timestamp": 1700000904000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "express",
    "platform": "server",
    "url": "https://shop.example.com/demo/booked"
  }
}
```

Mapping

```json
{
  "name": "demo_booked"
}
```

Out

```javascript
sendServer("https://bzr.openai.com/v1/events?pid=px_abc123", "{\"integration_source\":\"walkeros\",\"events\":[{\"id\":\"ev-1700000904\",\"type\":\"custom\",\"custom_event_name\":\"demo_booked\",\"timestamp_ms\":1700000904000,\"source_url\":\"https://shop.example.com/demo/booked\",\"action_source\":\"web\",\"data\":{\"type\":\"custom\"}}]}", {
  "headers": {
    "Authorization": "Bearer s3cr3t",
    "Content-Type": "application/json"
  }
})
```

### Lead

A demo request form is sent as lead\_created with the hashed email and phone.

Event

```json
{
  "name": "form submit",
  "data": {
    "type": "demo",
    "email": "user@example.com",
    "phone": "+1 (415) 555-2671"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "lang": "elb"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "ev-1700000901",
  "trigger": "test",
  "entity": "form",
  "action": "submit",
  "timestamp": 1700000901000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "express",
    "platform": "server",
    "url": "https://shop.example.com/demo"
  }
}
```

Mapping

```json
{
  "name": "lead_created",
  "data": {
    "map": {
      "email": "data.email",
      "phone": "data.phone"
    }
  }
}
```

Out

```javascript
sendServer("https://bzr.openai.com/v1/events?pid=px_abc123", "{\"integration_source\":\"walkeros\",\"events\":[{\"id\":\"ev-1700000901\",\"type\":\"lead_created\",\"timestamp_ms\":1700000901000,\"source_url\":\"https://shop.example.com/demo\",\"action_source\":\"web\",\"user\":{\"emails_sha256\":[\"b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514\"],\"phone_numbers_sha256\":[\"758fbf68945f21c416814c539ab578876c8d98fb69e6da692def92cd52417fe0\"]},\"data\":{\"type\":\"customer_action\"}}]}", {
  "headers": {
    "Authorization": "Bearer s3cr3t",
    "Content-Type": "application/json"
  }
})
```

### Page view

A page view is sent to OpenAI Ads as page\_viewed.

Event

```json
{
  "name": "page view",
  "data": {
    "domain": "www.example.com",
    "title": "walkerOS documentation",
    "referrer": "https://www.walkeros.io/",
    "search": "?foo=bar",
    "hash": "#hash",
    "id": "/docs/"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "pagegroup": "docs"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "f0cc5f6fec3d8eeb",
  "trigger": "load",
  "entity": "page",
  "action": "view",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/docs/"
  }
}
```

Mapping

```json
{
  "name": "page_viewed"
}
```

Out

```javascript
sendServer("https://bzr.openai.com/v1/events?pid=px_abc123", "{\"integration_source\":\"walkeros\",\"events\":[{\"id\":\"f0cc5f6fec3d8eeb\",\"type\":\"page_viewed\",\"timestamp_ms\":1700000000000,\"source_url\":\"https://www.example.com/docs/\",\"action_source\":\"web\",\"data\":{\"type\":\"contents\"}}]}", {
  "headers": {
    "Authorization": "Bearer s3cr3t",
    "Content-Type": "application/json"
  }
})
```

### Add to cart

A product add is sent as items\_added with the product, its quantity and its price in minor units.

Event

```json
{
  "name": "product add",
  "data": {
    "id": "ers",
    "name": "Everyday Ruck Snack",
    "color": "black",
    "size": "l",
    "price": 420,
    "quantity": 1,
    "currency": "EUR"
  },
  "context": {
    "shopping": [
      "intent",
      0
    ]
  },
  "globals": {
    "pagegroup": "shop"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n"
  },
  "nested": [],
  "consent": {
    "functional": true
  },
  "id": "83e860384d50953f",
  "trigger": "click",
  "entity": "product",
  "action": "add",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://shop.example.com/ers"
  }
}
```

Mapping

```json
{
  "name": "items_added",
  "data": {
    "map": {
      "contents": {
        "set": [
          {
            "map": {
              "id": "data.id",
              "name": "data.name",
              "quantity": "data.quantity",
              "amount": "data.price",
              "currency": "data.currency"
            }
          }
        ]
      }
    }
  }
}
```

Out

```javascript
sendServer("https://bzr.openai.com/v1/events?pid=px_abc123", "{\"integration_source\":\"walkeros\",\"events\":[{\"id\":\"83e860384d50953f\",\"type\":\"items_added\",\"timestamp_ms\":1700000000000,\"source_url\":\"https://shop.example.com/ers\",\"action_source\":\"web\",\"data\":{\"type\":\"contents\",\"contents\":[{\"id\":\"ers\",\"name\":\"Everyday Ruck Snack\",\"quantity\":1,\"amount\":42000,\"currency\":\"EUR\"}]}}]}", {
  "headers": {
    "Authorization": "Bearer s3cr3t",
    "Content-Type": "application/json"
  }
})
```

### Product view

A product view is sent as contents\_viewed with the product and its price in minor units.

Event

```json
{
  "name": "product view",
  "data": {
    "id": "ers",
    "name": "Everyday Ruck Snack",
    "color": "black",
    "size": "l",
    "price": 420,
    "currency": "EUR"
  },
  "context": {
    "shopping": [
      "detail",
      0
    ]
  },
  "globals": {
    "pagegroup": "shop"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n"
  },
  "nested": [],
  "consent": {
    "functional": true
  },
  "id": "db22fb16c70f663d",
  "trigger": "load",
  "entity": "product",
  "action": "view",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://shop.example.com/ers"
  }
}
```

Mapping

```json
{
  "name": "contents_viewed",
  "data": {
    "map": {
      "contents": {
        "set": [
          {
            "map": {
              "id": "data.id",
              "name": "data.name",
              "amount": "data.price",
              "currency": "data.currency"
            }
          }
        ]
      }
    }
  }
}
```

Out

```javascript
sendServer("https://bzr.openai.com/v1/events?pid=px_abc123", "{\"integration_source\":\"walkeros\",\"events\":[{\"id\":\"db22fb16c70f663d\",\"type\":\"contents_viewed\",\"timestamp_ms\":1700000000000,\"source_url\":\"https://shop.example.com/ers\",\"action_source\":\"web\",\"data\":{\"type\":\"contents\",\"contents\":[{\"id\":\"ers\",\"name\":\"Everyday Ruck Snack\",\"amount\":42000,\"currency\":\"EUR\"}]}}]}", {
  "headers": {
    "Authorization": "Bearer s3cr3t",
    "Content-Type": "application/json"
  }
})
```

### Purchase

An order complete is sent as order\_created with the total in minor units and one content per product.

Event

```json
{
  "name": "order complete",
  "data": {
    "id": "0rd3r1d",
    "currency": "EUR",
    "value": 462,
    "tax": 73.76,
    "shipping": 5.22,
    "total": 467.22
  },
  "context": {
    "shopping": [
      "complete",
      0
    ]
  },
  "globals": {
    "pagegroup": "shop"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n"
  },
  "nested": [
    {
      "entity": "product",
      "data": {
        "id": "ers",
        "name": "Everyday Ruck Snack",
        "color": "black",
        "size": "l",
        "price": 420
      },
      "context": {
        "shopping": [
          "complete",
          0
        ]
      },
      "nested": []
    },
    {
      "entity": "product",
      "data": {
        "id": "cc",
        "name": "Cool Cap",
        "size": "one size",
        "price": 42
      },
      "context": {
        "shopping": [
          "complete",
          0
        ]
      },
      "nested": []
    },
    {
      "entity": "gift",
      "data": {
        "name": "Surprise"
      },
      "context": {
        "shopping": [
          "complete",
          0
        ]
      },
      "nested": []
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "235d0d7bd7a213f2",
  "trigger": "load",
  "entity": "order",
  "action": "complete",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://shop.example.com/thanks"
  }
}
```

Mapping

```json
{
  "name": "order_created",
  "data": {
    "map": {
      "amount": "data.total",
      "currency": "data.currency",
      "contents": {
        "loop": [
          "nested",
          {
            "condition": {
              "$code": "e=>\"object\"==typeof e&&null!==e&&\"entity\"in e&&\"product\"===e.entity"
            },
            "map": {
              "id": "data.id",
              "name": "data.name",
              "quantity": "data.quantity",
              "amount": "data.price"
            }
          }
        ]
      }
    }
  }
}
```

Out

```javascript
sendServer("https://bzr.openai.com/v1/events?pid=px_abc123", "{\"integration_source\":\"walkeros\",\"events\":[{\"id\":\"235d0d7bd7a213f2\",\"type\":\"order_created\",\"timestamp_ms\":1700000000000,\"source_url\":\"https://shop.example.com/thanks\",\"action_source\":\"web\",\"data\":{\"type\":\"contents\",\"amount\":46722,\"currency\":\"EUR\",\"contents\":[{\"id\":\"ers\",\"name\":\"Everyday Ruck Snack\",\"amount\":42000},{\"id\":\"cc\",\"name\":\"Cool Cap\",\"amount\":4200}]}}]}", {
  "headers": {
    "Authorization": "Bearer s3cr3t",
    "Content-Type": "application/json"
  }
})
```

### Purchase with click and match keys

An order with its own order id for deduplication, the oppref click reference, the pixel's obref and match keys: OpenAI's example event.

Event

```json
{
  "name": "order complete",
  "data": {
    "id": "order_12345",
    "total": 25.99,
    "currency": "USD"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "oppref": "oppref_abc",
    "obref": "123e4567-e89b-42d3-a456-426614174000"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "customer_123",
    "email": "user@example.com",
    "country": "US",
    "city": "San Francisco",
    "zip": "94107",
    "ip": "203.0.113.1",
    "userAgent": "Mozilla/5.0"
  },
  "nested": [
    {
      "entity": "product",
      "data": {
        "id": "sku_123",
        "name": "Starter bundle",
        "quantity": 1
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "ev-1773892800",
  "trigger": "test",
  "entity": "order",
  "action": "complete",
  "timestamp": 1773892800000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "express",
    "platform": "server",
    "url": "https://shop.example.com/checkout/confirmation"
  }
}
```

Mapping

```json
{
  "name": "order_created",
  "data": {
    "map": {
      "id": "data.id",
      "oppref": "globals.oppref",
      "obref": "globals.obref",
      "email": "user.email",
      "external_id": "user.id",
      "country": "user.country",
      "city": "user.city",
      "postal_code": "user.zip",
      "amount": "data.total",
      "currency": "data.currency",
      "contents": {
        "loop": [
          "nested",
          {
            "map": {
              "id": "data.id",
              "name": "data.name",
              "content_type": {
                "value": "product"
              },
              "quantity": "data.quantity"
            }
          }
        ]
      }
    }
  }
}
```

Out

```javascript
sendServer("https://bzr.openai.com/v1/events?pid=px_abc123", "{\"integration_source\":\"walkeros\",\"events\":[{\"id\":\"order_12345\",\"type\":\"order_created\",\"timestamp_ms\":1773892800000,\"oppref\":\"oppref_abc\",\"source_url\":\"https://shop.example.com/checkout/confirmation\",\"action_source\":\"web\",\"user\":{\"emails_sha256\":[\"b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514\"],\"external_ids_sha256\":[\"18f69bcd2f9cc9c38195e722b2a5590429840ea5090971d2256e026926e55fa1\"],\"obref\":\"123e4567-e89b-42d3-a456-426614174000\",\"countries\":[\"US\"],\"cities\":[\"San Francisco\"],\"postal_codes\":[\"94107\"],\"user_agent\":\"Mozilla/5.0\",\"ip_address\":\"203.0.113.1\"},\"data\":{\"type\":\"contents\",\"amount\":2599,\"currency\":\"USD\",\"contents\":[{\"id\":\"sku_123\",\"name\":\"Starter bundle\",\"content_type\":\"product\",\"quantity\":1}]}}]}", {
  "headers": {
    "Authorization": "Bearer s3cr3t",
    "Content-Type": "application/json"
  }
})
```

### Registration

A sign-up is sent as registration\_completed with the hashed user id as external id and the hashed names.

Event

```json
{
  "name": "user register",
  "data": {
    "id": "customer_123",
    "first_name": "Mary Jane",
    "last_name": "O'Connor"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "lang": "elb"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "ev-1700000902",
  "trigger": "test",
  "entity": "user",
  "action": "register",
  "timestamp": 1700000902000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "express",
    "platform": "server",
    "url": "https://shop.example.com/signup"
  }
}
```

Mapping

```json
{
  "name": "registration_completed",
  "data": {
    "map": {
      "external_id": "data.id",
      "first_name": "data.first_name",
      "last_name": "data.last_name"
    }
  }
}
```

Out

```javascript
sendServer("https://bzr.openai.com/v1/events?pid=px_abc123", "{\"integration_source\":\"walkeros\",\"events\":[{\"id\":\"ev-1700000902\",\"type\":\"registration_completed\",\"timestamp_ms\":1700000902000,\"source_url\":\"https://shop.example.com/signup\",\"action_source\":\"web\",\"user\":{\"external_ids_sha256\":[\"18f69bcd2f9cc9c38195e722b2a5590429840ea5090971d2256e026926e55fa1\"],\"first_names_sha256\":[\"f08f448a5e7a9dc3619bb7c129f6a7d5fc6af002cea17ad71dfdc1c68f4d4e0e\"],\"last_names_sha256\":[\"7a0fbfdf40cbeb97429bdb88f512cecd27f0d44b7e57986ab578423bb61936ac\"]},\"data\":{\"type\":\"customer_action\"}}]}", {
  "headers": {
    "Authorization": "Bearer s3cr3t",
    "Content-Type": "application/json"
  }
})
```

### Subscription

A paid subscription is sent as subscription\_created with its plan and amount.

Event

```json
{
  "name": "subscription start",
  "data": {
    "plan": "business_yearly",
    "price": 990,
    "currency": "USD"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "lang": "elb"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "ev-1700000903",
  "trigger": "test",
  "entity": "subscription",
  "action": "start",
  "timestamp": 1700000903000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "express",
    "platform": "server",
    "url": "https://shop.example.com/billing"
  }
}
```

Mapping

```json
{
  "name": "subscription_created",
  "data": {
    "map": {
      "plan_id": "data.plan",
      "amount": "data.price",
      "currency": "data.currency"
    }
  }
}
```

Out

```javascript
sendServer("https://bzr.openai.com/v1/events?pid=px_abc123", "{\"integration_source\":\"walkeros\",\"events\":[{\"id\":\"ev-1700000903\",\"type\":\"subscription_created\",\"timestamp_ms\":1700000903000,\"source_url\":\"https://shop.example.com/billing\",\"action_source\":\"web\",\"data\":{\"type\":\"plan_enrollment\",\"amount\":99000,\"currency\":\"USD\",\"plan_id\":\"business_yearly\"}}]}", {
  "headers": {
    "Authorization": "Bearer s3cr3t",
    "Content-Type": "application/json"
  }
})
```

## When it fails

* **amount without currency**: Prices without a currency cannot be sent in minor units: an order without a currency fails with missing-input and nothing is sent. Reported as `failed` with code `missing-input`.
* **app event from web**: An app event without action\_source mobile\_app fails with missing-input and nothing is sent. Reported as `failed` with code `missing-input`.
* **bad request**: OpenAI answers HTTP 400 (an invalid field, or a list with more than three values): the push fails with transport, not retryable, and the event goes to the dead-letter queue. Reported as `failed` with code `transport`.
* **invalid custom name**: A custom event name with other characters than letters, digits, \_ and - fails with missing-input and nothing is sent. Reported as `failed` with code `missing-input`.
* **unknown currency**: An amount whose currency is not an ISO 4217 code cannot be sent in minor units: the push fails with missing-input and nothing is sent. Reported as `failed` with code `missing-input`.
* **unnamed event**: A rule without a name gives the event no OpenAI type: the push fails with missing-input and nothing is sent. Reported as `failed` with code `missing-input`.
* **web event without url**: A web event (action\_source web, the default) without a source URL fails with missing-input and nothing is sent. Reported as `failed` with code `missing-input`.

## Event types[​](#event-types "Direct link to Event types")

The rule's `name` is the OpenAI event type; a space becomes `_`. Standard types and the shape of their `data`:

| Type                                                                                 | `data.type`       |
| ------------------------------------------------------------------------------------ | ----------------- |
| `appointment_scheduled`, `lead_created`, `registration_completed`                    | `customer_action` |
| `app_installed`, `app_opened` (need `action_source` `mobile_app`)                    | `customer_action` |
| `checkout_started`, `contents_viewed`, `items_added`, `order_created`, `page_viewed` | `contents`        |
| `subscription_created`, `trial_started`                                              | `plan_enrollment` |

Any other name is sent as `type: "custom"` with that name, lowercased, as `custom_event_name` (letters, digits, `_` and `-`, at most 64 characters, and not `custom`).

Without a `mapping` in your config, the destination uses its own rules: `page view` is sent as `page_viewed`, `product view` as `contents_viewed`, `product add` as `items_added` and `order complete` as `order_created`, each with the amounts and contents the Page view, Product view, Add to cart and Purchase examples above show, and every other event is ignored. A `mapping` in your config replaces these rules as a whole, so copy the rules you keep from those examples. An event whose rule has no `name` cannot be sent and fails.

## Mapped data[​](#mapped-data "Direct link to Mapped data")

A rule's `data` maps these keys:

| Field                                                      | Sent as                                                                                                                                                                                                                                     |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                                                       | `id`, OpenAI's deduplication id (default: the walkerOS event id)                                                                                                                                                                            |
| `action_source`                                            | `action_source` (default: `settings.action_source`, else `web`)                                                                                                                                                                             |
| `source_url`                                               | `source_url` (default: `event.source.url`), required for `web`                                                                                                                                                                              |
| `oppref`                                                   | `oppref`, the OpenAI click reference from the landing URL, unchanged                                                                                                                                                                        |
| `email`, `phone`, `external_id`, `first_name`, `last_name` | `user.emails_sha256`, `user.phone_numbers_sha256`, `user.external_ids_sha256`, `user.first_names_sha256`, `user.last_names_sha256` (see [Hashing](#hashing))                                                                                |
| `obref`                                                    | `user.obref`, the OpenAI pixel's `__obref` cookie, unchanged                                                                                                                                                                                |
| `country`                                                  | `user.countries`, two-letter codes, uppercased                                                                                                                                                                                              |
| `region`, `city`, `postal_code`                            | `user.regions`, `user.cities`, `user.postal_codes` (in clear)                                                                                                                                                                               |
| `android_advertising_id`                                   | `user.android_advertising_id` (in clear)                                                                                                                                                                                                    |
| `user_agent`, `ip_address`                                 | `user.user_agent`, `user.ip_address` (in clear)                                                                                                                                                                                             |
| `amount`, `currency`                                       | `data.amount` in the ISO 4217 minor unit of `data.currency` (99.90 USD is `9990`, 1000 HUF is `100000`), `data.currency` uppercased                                                                                                         |
| `contents`                                                 | `data.contents`, a list of items with `id`, `group_id`, `name`, `content_type`, `quantity` (a whole number), `amount` (per unit, in minor units of the item's `currency` or the event's) and `variant_dict`; not on `customer_action` types |
| `plan_id`                                                  | `data.plan_id`, on `plan_enrollment` and custom types                                                                                                                                                                                       |

The user fields take a string or a list, with at most three values each. A mapped value the destination cannot send is left out and reported in one ERROR line: a key not in this table, a fourth value of a list, a phone that is not 8 to 15 digits, a country that is not a two-letter code, `contents` or `plan_id` on a type that does not take them. An `amount` whose `currency` is missing or not an ISO 4217 code cannot be sent in minor units and fails the event.

OpenAI deduplicates on the Pixel ID, the event type (the `custom_event_name` for custom events) and `id`. If the OpenAI pixel tracks the same conversion in the browser, map the same id it sends as `event_id`, such as the order id:

An order with its own order id for deduplication, the oppref click reference, the pixel's obref and match keys: OpenAI's example event.

Event

```json
{
  "name": "order complete",
  "data": {
    "id": "order_12345",
    "total": 25.99,
    "currency": "USD"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "oppref": "oppref_abc",
    "obref": "123e4567-e89b-42d3-a456-426614174000"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "customer_123",
    "email": "user@example.com",
    "country": "US",
    "city": "San Francisco",
    "zip": "94107",
    "ip": "203.0.113.1",
    "userAgent": "Mozilla/5.0"
  },
  "nested": [
    {
      "entity": "product",
      "data": {
        "id": "sku_123",
        "name": "Starter bundle",
        "quantity": 1
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "ev-1773892800",
  "trigger": "test",
  "entity": "order",
  "action": "complete",
  "timestamp": 1773892800000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "express",
    "platform": "server",
    "url": "https://shop.example.com/checkout/confirmation"
  }
}
```

Mapping

```json
{
  "name": "order_created",
  "data": {
    "map": {
      "id": "data.id",
      "oppref": "globals.oppref",
      "obref": "globals.obref",
      "email": "user.email",
      "external_id": "user.id",
      "country": "user.country",
      "city": "user.city",
      "postal_code": "user.zip",
      "amount": "data.total",
      "currency": "data.currency",
      "contents": {
        "loop": [
          "nested",
          {
            "map": {
              "id": "data.id",
              "name": "data.name",
              "content_type": {
                "value": "product"
              },
              "quantity": "data.quantity"
            }
          }
        ]
      }
    }
  }
}
```

Out

```javascript
sendServer("https://bzr.openai.com/v1/events?pid=px_abc123", "{\"integration_source\":\"walkeros\",\"events\":[{\"id\":\"order_12345\",\"type\":\"order_created\",\"timestamp_ms\":1773892800000,\"oppref\":\"oppref_abc\",\"source_url\":\"https://shop.example.com/checkout/confirmation\",\"action_source\":\"web\",\"user\":{\"emails_sha256\":[\"b4c9a289323b21a01c3e940f150eb9b8c542587f1abfd8f0e1cc1ffc5e475514\"],\"external_ids_sha256\":[\"18f69bcd2f9cc9c38195e722b2a5590429840ea5090971d2256e026926e55fa1\"],\"obref\":\"123e4567-e89b-42d3-a456-426614174000\",\"countries\":[\"US\"],\"cities\":[\"San Francisco\"],\"postal_codes\":[\"94107\"],\"user_agent\":\"Mozilla/5.0\",\"ip_address\":\"203.0.113.1\"},\"data\":{\"type\":\"contents\",\"amount\":2599,\"currency\":\"USD\",\"contents\":[{\"id\":\"sku_123\",\"name\":\"Starter bundle\",\"content_type\":\"product\",\"quantity\":1}]}}]}", {
  "headers": {
    "Authorization": "Bearer s3cr3t",
    "Content-Type": "application/json"
  }
})
```

## Hashing[​](#hashing "Direct link to Hashing")

The destination normalizes and SHA-256 hashes these keys, a list item by item. An empty value, or one that is empty after normalization, is left out.

| Key                       | Normalization before hashing                                                                                                                                                                            |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `email`                   | Trim and lowercase.                                                                                                                                                                                     |
| `phone`                   | Remove whitespace, parentheses, periods and hyphens, then a leading `+` and leading zeroes. The result must be 8 to 15 digits with the country calling code: `+1 (415) 555-2671` becomes `14155552671`. |
| `external_id`             | Trim; the case is kept.                                                                                                                                                                                 |
| `first_name`, `last_name` | Lowercase, remove whitespace and ASCII punctuation; accented and non-Latin letters are kept (`O'Connor` becomes `oconnor`, `José` becomes `josé`).                                                      |

If a value is already hashed, add its key to `doNotHash`: the destination sends it exactly as mapped, so it must already be a SHA-256 digest. Map personal data only to these keys.

## Client IP and user agent[​](#client-ip-and-user-agent "Direct link to Client IP and user agent")

The destination sends the client IP as `user.ip_address` and the user agent as `user.user_agent` by default. The `ip` and `userAgent` settings resolve against `{ ingest, event }` and default to `["ingest.ip", "event.user.ip"]` and `["ingest.userAgent", "event.user.userAgent"]` (see the `config.ingest` recipe on the [Express source](https://www.walkeros.io/docs/sources/server/express.md#ingest-metadata)). A mapped `ip_address` or `user_agent` wins. Set either setting to `false` to turn it off.

## Consent[​](#consent "Direct link to Consent")

The quickstart sets no `config.consent`, so OpenAI Ads receives every event, whatever consent the event carries. To send only events with consent, add `consent: { marketing: true }` to `config`, next to `settings` (with several keys listed, one granted key is enough). An event without that consent is skipped or queued, depending on the collector's `consentDenied`. Server flows built by the CLI skip it and count it in `skipped`. With `startFlow` it waits in the destination's queue by default: a later event that carries consent does not release it, and only a `walker consent` command does, which then sends the waiting events of every user at once. Pass `consentDenied: 'skip'` to `startFlow` to skip such events instead (see [Gate a destination with consent](https://www.walkeros.io/docs/guides/consent.md#gate-a-destination-with-consent) and [consent-denied events on a server](https://www.walkeros.io/docs/collector.md#consent-denied-events-on-a-server)).

OpenAI refuses events older than 7 days or more than 10 minutes in the future: `timestamp_ms` is the walkerOS event timestamp.

## Testing[​](#testing "Direct link to Testing")

Set `validate_only: true` in settings: OpenAI validates each request and records nothing. Validated events do not show in OpenAI's event monitoring, and a flow left with `validate_only: true` records no conversions while every push succeeds.

## Links[​](#links "Direct link to Links")

* [OpenAI Ads Conversions API](https://developers.openai.com/ads/conversions-api)
