I'm trying to develop a bot for my booking business. Below is my starter bot flow:
const axios = require("axios").default;
function start_bot(msg_body, phone_id, token, from, user_name) {
if (msg_body === "Hi") {
axios({
method: "post",
url: `https://graph.facebook.com/v17.0/${phone_id}/messages?access_token=${token}`,
data: {
messaging_product: "whatsapp",
recipient_type: "individual",
to: from,
type: "interactive",
interactive: {
type: "button",
body: {
text: ` Hello ${user_name}, welcome to Expatman! We are here to help you with your visa, work permit, labor placement, and foreign company representation needs. To get started, please select one of the following service options: `,
},
action: {
buttons: [
{
type: "reply",
reply: {
id: "vawp",
title: "Visas",
},
},
{
type: "reply",
reply: {
id: "lp",
title: "Labour",
},
},
{
type: "reply",
reply: {
id: "rofc",
title: "Representation",
},
},
],
},
},
},
headers: { "Content-Type": "application/json" },
});
}
}
module.exports = start_bot;
Now, I want to send a reply to the user based on the type of button they click on. How can I do that!? Please help
I've checked the official FB dev documentation and tons of videos, no one seems to be teaching how to reply to users button input.