This guide adds a button to your Libromi chatbot that opens your website inside WhatsApp, already signed in as the customer. Read Shop in WhatsApp with your chatbot first for what the customer gets.
The Libromi screens below follow Libromi's own help pages. Libromi may name a button differently on your account; if something does not match, ask Libromi support.
1. Prepare your shop
- In QuickCommerce, open Shop › WhatsApp › Chat shopping links.
- Select Switch on.
- Next to Allow simple key (no signature), select Switch on. A Libromi chatbot cannot compute a signature, so it sends the secret as a key.
- Select Create secret and copy the secret. It is shown only once.
- Copy the API address.
- Select Test the set-up. You should see "Everything is set up. Your chat platform can now create links."
See Switch it on for each part of the card.
In Libromi, open Chatbot, open your bot, and turn on Static Variables in the builder header. Your bot can then use the customer's details:
| Variable | Holds |
|---|
{{STAT_PHONE}} | The customer's WhatsApp number |
{{STAT_NAME}} | Their WhatsApp profile name |
{{STAT_CONV_ID}} | The conversation number |
Without Static Variables on, these are empty and every request fails.
3. Ask your shop for a link
Add a Webhook block (under Integrations) where the customer chooses to shop, for example after a "Shop now" reply button. Set it up like this:
| Setting | Value |
|---|
| Method | POST |
| URL | The API address from your shop |
| Header | Authorization with the value Bearer followed by your secret |
| Header | Content-Type with the value application/json |
| Body | See below |
{
"phone": "{{STAT_PHONE}}",
"name": "{{STAT_NAME}}",
"intent": "shop",
"externalRef": "{{STAT_CONV_ID}}"
}
- The phone needs its country code, with or without
+: +971501234567 and 971501234567 both work. A local number starting with 0, such as 0501234567, is refused. Use STAT_PHONE as it is, and test with your own number to check.
externalRef comes back with any order the customer places, so your team can match the order to the chat.
- To land on a page, add
"path": "/collections/fruits" with a path from your website. Without it, the home page opens.
Then map the answer into variables:
| Answer field | Save into |
|---|
url | A variable such as shopLink |
| The status code | A variable such as shopStatus |
The Webhook block has no failure exit. Add a Condition after it: when shopStatus is 200, go on to the button; otherwise send a short apology, such as "Sorry, the shop link is not available right now. Please try again in a minute."
Add a Link block (under Messages). It sends a button that opens a web address.
- Text: for example "Tap below to shop. The link works for 10 minutes."
- Button title: for example "Open the shop".
- Address:
{{shopLink}}.
WhatsApp opens the link in its own browser, and the customer is signed in.
Make the link when the customer taps, not in advance: it works once, for 10 minutes. If the customer comes back later, the bot simply makes a new one.
5. Test it
- In Libromi, select Test Bot and message your bot from your own phone.
- Tap the button. Your website should open with you signed in.
- On your shop's card, Last used changes to now, with (simple key).
If it fails, the status code tells you why. See Chat shopping links: troubleshooting.
6. A checkout link for a WhatsApp catalogue cart
When a customer builds a cart in your WhatsApp catalogue, a second Webhook block can send them straight to the checkout with those products. Use "intent": "checkout" and list the products:
{
"phone": "{{STAT_PHONE}}",
"name": "{{STAT_NAME}}",
"intent": "checkout",
"lines": [
{ "productId": 123, "quantity": 2 },
{ "productId": 124, "variantId": 456, "quantity": 1 }
],
"externalRef": "{{STAT_CONV_ID}}"
}
productId and variantId are your shop's product and variant numbers, the ones your catalogue sync sends to WhatsApp. How Libromi hands your bot the cart's products depends on your Libromi set-up; ask Libromi support how to put them in the body.
Products that cannot be bought are left out and listed in the answer under unavailableLines. If none can be bought, the status is 422 and no link is made.
Use "intent": "reorder". The checkout opens with the products of the customer's last order that can still be bought. A customer with no such order gets status 422.
{ "phone": "{{STAT_PHONE}}", "intent": "reorder", "externalRef": "{{STAT_CONV_ID}}" }
8. Order updates in the chat
When your WhatsApp is connected, orders from these links get your WhatsApp order updates like any WhatsApp order. See When WhatsApp order updates are sent. Their source is WhatsApp (web).
Keep the secret safe
- The secret signs customers in. Keep it in the Webhook block's header only, never in a message text.
- Anyone who can edit your bot can see it. If someone who should not have it may have seen it, select Rotate secret, paste the new one within 24 hours, and the old one stops.
- When your platform can compute signatures, switch Allow simple key (no signature) off and use signed requests.