Send the event.
Prepare the email.
Connect confirmed product events to approved email workflows. Your code supplies the facts; barua renders the message.
const response = await fetch(
"https://barua.ai/api/integrations/v1/events",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.BARUA_TEST_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ records: [{
event_id: "order_delayed:shp_9f2a:2026-10-21",
name: "order_delayed",
external_id: "nt_u_8812",
occurred_at: "2026-10-14T14:40:00Z",
properties: {
order_id: "48213",
order_name: "#48213",
shipment_id: "shp_9f2a",
carrier: "Bring",
eta_date: "2026-10-21",
tracking_number: "370412345678",
tracking_url: "https://northtrail.example/orders/48213/tracking",
line_items: [
{ name: "Charcoal wool base layer, M", quantity: 1, price: 1190 },
{ name: "Merino liner socks", quantity: 2, price: 249 }
]
}
}] })
}
);
const receipt = await response.json();202 Accepted
{
"receipt_id": "00000000-0000-4000-8000-000000000001",
"accepted_at": "2026-10-14T14:41:00Z",
"replayed": false,
"key_mode": "test",
"records": [{
"ordinal": 1,
"disposition": "validated",
"reason": null
}]
}A test key checks the event and stops there. With a live key, inspect the receipt until the event settles, then check the email’s delivery state.
Explore the example · Fictional brands and data · No emails sent
The facts stay
with the order.
The carrier, delivery date and item names come from the event. Reusable wording surrounds the customer’s actual order details.
order_name#48213eta_date21 October 2026carrierBringline_itemsThe ordered itemsA few things
to put in place.
Use the setup guide to connect your product and verify the test events.
Read the integration guide ↗- Identify the customer. Send signed_up before the customer’s later events.
- Approve the event plan. Use the supported fields and your granted key permissions.
- Prepare the sender and Play. Verify the domain and approve the relevant email.
- Enable live events and sending. Check intake and delivery separately.
A few useful details.
Which service emails are supported?
Receipts and the defined order updates: shipped, delivered, delayed, canceled, and refunded. Customer password resets and login codes are not supported by this API.
How quickly does an email send?
Usually within hours. Events expire after 24 hours, and close-together orders from the same customer can produce only the latest receipt. Use this for workflows where those limits fit.
Connect the first event.
Read the integration guide, then talk to us about access for your product.