Recipes: common setups
Ready-made patterns for order updates, website leads, CRM sync and no-code tools.
Order shipped message from your store
-
Create the template
Body: Hi {{1}}, your order {{2}} has shipped, plus a Track order button whose link ends in a variable. Get it approved.
Campaigns Templates
-
Note its id
Call
GET /templates. -
Call the API when the order ships
From your store's "order shipped" event or hook.
-
Watch for failures
Subscribe to the
message_failedwebhook so a wrong number never goes unnoticed.
// Called by your store when an order ships.
async function notifyShipped(order) {
const res = await fetch('https://flowleb.com/api/v1/templates/31/send', { // 31 = "order_shipped"
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.FLOWLEB_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: order.phone.replace(/\D/g, ''), // digits only
body: [order.firstName, `#${order.number}`], // {{1}}, {{2}}
buttons: [{ index: 0, sub_type: 'url', value: String(order.number) }],
}),
});
const json = await res.json();
if (!res.ok) console.error('WhatsApp not sent', json.error);
return json.data?.wamid;
}
Website form to WhatsApp follow-up
-
Build a flow
Welcome message, a question or two, a reminder the next day. Publish it.
Automation Flows
-
On form submit, create the contact
POST /contactswith name and phone. -
Then start the flow
POST /flows/{id}/enrollwith the same phone.
The complete handler is in Start an automation from your app.
Customer replies into your CRM
-
Add a webhook
Events:
message_receivedandmessage_failed.Developer Webhooks
-
Verify the signature
Use the handler from Webhooks.
-
Write to your CRM
Match on the phone number and add the message as an activity.
// After verifying the signature (see Webhooks):
switch (event.event) {
case 'message_received':
await crm.addActivity({
phone: event.data.from_number,
note: `WhatsApp: ${event.data.body}`,
});
break;
case 'message_failed':
await crm.flag(event.data, 'WhatsApp message failed');
break;
}
No-code: n8n, Zapier or Make
Any tool with an "HTTP request" or "Webhooks" step can use the API. Fill in the step like this:
- Method
POST- URL
https://flowleb.com/api/v1/messages(or any other endpoint)- Header
Authorization=Bearer wsk_your_key- Body type
- JSON
- Body
{"to": "919876543210", "text": "Hi!"}, using the tool's fields for the values
To go the other way (Flowleb starts your workflow), copy the tool's "catch webhook" address into a Flowleb webhook. Flowleb also has a dedicated n8n page under Developer › n8n.