Botón
function Buttons(number, bodyText, buttonTitles){
const buttonsArray = buttonTitles.slice(0, 3).map((title, index) => {
return {
type: 'reply',
reply: {
id: String(index).padStart(5, '0'),
title: title
}
};
});
const data = JSON.stringify({
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": number,
"type": "interactive",
"interactive": {
"type": "button",
"body": {
"text": bodyText
},
"action": {
"buttons": buttonsArray
}
}
});
return data;
}Última actualización