Events
Events are Bento's secret weapon. These tiny data points offer sharp insights and trigger advanced automations the moment they arrive.
Events capture micro-data so you can trigger automations and build granular analytics without waiting on nightly imports.
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/batch/events | Create Events |
The events model
Capture micro-interactions with event name, primary user email, and optional metadata payloads.
type · string
Event name (e.g., `$purchase`, `Signup Completed`).
email · string
Email for the visitor tied to the event. New visitors are created automatically.
fields · object
Flat key/value attributes stored on the visitor record (non-nested).
details · object
Nested metadata saved on the event itself (cart details, values, unique keys, etc.).
Create Events
Send batches of up to 1,000 events to Bento for analytics, automations, and downstream syncing.
Required attributes
- events[].type · string
- Event name to record.
- events[].email · string
- Visitor email tied to the event.
Optional attributes
- events[].fields · object
- Flat key/value metadata saved directly on the visitor.
- events[].details · object
- Nested key/value payload stored on the event.
cURL
bashcurl -L -u publishableKey:secretKey \
-X POST "https://app.bentonow.com/api/v1/batch/events?site_uuid=ExampleID1234" \
-H "Content-Type: application/json" \
--data-raw '{
"events": [
{
"type": "$completed_onboarding",
"email": "test@test.com"
},
{
"type": "$purchase",
"email": "test@test.com",
"fields": {
"first_name": "Jesse"
},
"details": {
"unique": { "key": "test123" },
"value": { "currency": "USD", "amount": 8000 },
"cart": {
"items": [
{
"product_sku": "SKU123",
"product_name": "Test",
"quantity": 100
}
],
"abandoned_checkout_url": "https://test.com"
}
}
}
]
}'
JavaScript
javascriptconst axios = require('axios');
let data = {
events: [
{ type: '$completed_onboarding', email: 'test@test.com' },
{
type: '$purchase',
email: 'test@test.com',
fields: { first_name: 'Jesse' },
details: {
unique: { key: 'test123' },
value: { currency: 'USD', amount: 8000 },
cart: {
items: [
{
product_sku: 'SKU123',
product_name: 'Test',
quantity: 100,
},
],
abandoned_checkout_url: 'https://test.com',
},
},
},
],
};
let config = {
method: 'post',
url: 'https://app.bentonow.com/api/v1/batch/events',
params: { site_uuid: 'ExampleID1234' },
auth: {
username: 'publishableKey',
password: 'secretKey'
},
headers: {
'Content-Type': 'application/json'
},
data: JSON.stringify(data)
};
axios(config)
.then((response) => console.log(JSON.stringify(response.data)))
.catch((error) => console.error(error));
Node SDK
javascriptbento.V1.track({
email: 'test@bentonow.com',
type: '$custom.event',
fields: {
first_name: 'Custom Name',
last_name: 'Custom Name',
},
details: {
fromCustomEvent: true,
},
})
.then((result) => console.log(result))
.catch((error) => console.error(error));
Python
pythonfrom bento_api import BentoAPI
import os
api = BentoAPI(
site_uuid=os.getenv('BENTO_SITE_UUID'),
username=os.getenv('BENTO_PUBLISHABLE_KEY'),
password=os.getenv('BENTO_SECRET_KEY')
)
events = [
{"type": "$completed_onboarding", "email": "test@test.com"},
{
"type": "$purchase",
"email": "test@test.com",
"fields": {"first_name": "Jesse"},
"details": {
"unique": {"key": "test123"},
"value": {"currency": "USD", "amount": 8000}
}
}
]
result = api.batch_create_events(events)
Ruby
rubyBento::Events.track(email: 'test@test.com', type: '$completed_onboarding')
Bento::Events.track(
email: 'test@test.com',
type: '$purchase',
fields: { first_name: 'Jesse' },
details: {
unique: { key: 'test123' },
value: { currency: 'USD', amount: 8000 }
}
)
Response
Returns the number of events enqueued.
Response body
json{
"result": 3
}
Need the original Markdown? Open raw file