Developer docs
Get an API keyIotaBot Commerce
Attribute paid orders from your own storefront back to the chat that sold them.
Attribute a paid order from Node.js
Call the order-paid webhook from your checkout or payment handler.
- Put the store secret in
IOTABOT_STORE_SECRET(from Website → Store → Custom HTTP). - When payment succeeds, POST with the order's stored
conversation_id.
order-paid.js
// Node.js 18+: fetch is built in
const SECRET = process.env.IOTABOT_STORE_SECRET;
async function notifyIotaBotOrderPaid({ conversationId, orderId, orderNumber, total, currency }) {
const res = await fetch("https://api.iotabot.com/api/v1/webhooks/store/order", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-iotabot-secret": SECRET,
},
body: JSON.stringify({
conversation_id: conversationId,
order_id: orderId,
order_number: orderNumber,
total,
currency,
status: "paid",
platform: "custom",
}),
});
if (!res.ok) throw new Error(`IotaBot order webhook ${res.status}`);
return res.json(); // { ok: true }
}
// After your gateway confirms payment:
await notifyIotaBotOrderPaid({
conversationId: order.iotabotConversationId,
orderId: order.id,
orderNumber: order.number,
total: order.total,
currency: order.currency,
});
