From 3d12fa6f12bba577a9a2d10263b64f463622fbdb Mon Sep 17 00:00:00 2001 From: schwasa <102740850+schwasa@users.noreply.github.com> Date: Sun, 4 Feb 2024 23:07:24 +0100 Subject: [PATCH] Update invert buttons statements --- app.js | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/app.js b/app.js index 13a40d7..7196cc8 100644 --- a/app.js +++ b/app.js @@ -132,7 +132,18 @@ app.post('/webhook', async (req, res) => { }) } } else { - if ( + if (req.body.entry[0].changes[0].value.messages[0].type === "button" + ) { + await interact( + user_id, + { + type: 'text', + payload: req.body.entry[0].changes[0].value.messages[0].button.payload, + }, + phone_number_id, + user_name + ) + } else if ( req.body.entry[0].changes[0].value.messages[0].interactive.button_reply.id.includes( 'path-' ) @@ -151,20 +162,7 @@ app.post('/webhook', async (req, res) => { phone_number_id, user_name ) - } else if ( - req.body.entry[0].changes[0].value.messages[0].type === "button" - ) { - await interact( - user_id, - { - type: 'text', - payload: req.body.entry[0].changes[0].value.messages[0].button.payload, - }, - phone_number_id, - user_name - ) - } - else { + } else { await interact( user_id, {