bootbot
bootbot copied to clipboard
sendListTemplate : Error PostBack Buttons
Hello everyone,
I'm coming to you because I have a problem recovering the postBack when I use the sendListTemplate function.
When I click on a button I have an error message on facebook that tells me that there is a problem with the bot.
Here is my code, I hope you will be able to enlighten me.
> `bot.hear('begin', (payload, chat) => {
> var elements = [
>
> {
> "title" : "tilte",
> "subtitle" : "subtitle",
> "image_url" : "https://avatars1.githubusercontent.com/u/32040672?s=88&v=4",
> "buttons" : [ { type: 'postback', title: 'Settings', payload: 'HELP_SETTINGS' }]
> },
>
> {
> "title" : "tilte",
> "subtitle" : "subtitle",
> "image_url" : "https://avatars1.githubusercontent.com/u/32040672?s=88&v=4",
> "buttons" : [ { type: 'postback', title: 'Settings', payload: 'HELP_SETTINGS_2' } ]
> },
> {
> "title" : "tilte",
> "subtitle" : "subtitle",
> "image_url" : "https://avatars1.githubusercontent.com/u/32040672?s=88&v=4",
> "buttons" : [ { type: 'postback', title: 'Settings', payload: 'HELP_SETTINGS_3' } ]
> },
> {
> "title" : "tilte",
> "subtitle" : "subtitle",
> "image_url" : "https://avatars1.githubusercontent.com/u/32040672?s=88&v=4",
> "buttons" : [ { type: 'postback', title: 'Settings', payload: 'HELP_SETTINGS_4' } ]
> },
>
>
>
>
> ];
>
>
> chat.sendListTemplate(elements, [{ "title": "MORE", "type": "postback", "payload": "SET_SIGNE_MORE" }] );`
"PostBack Listener"
Test 1
> bot.on('postback:HELP_SETTINGS', (payload, chat, data) => {
> chat.say(`Here are your settings: ...`);
> console.log(1);
> //Do something
> });
TEST 2
> bot.on('postback', (payload, chat, data) => {
> const pb_payload = JSON.parse(payload.postback.payload);
>
> console.log(pb_payload);
>
> });
TEST 3
> bot.on('list:SET_SIGNE_MORE', (payload, chat) => {
> console.log(1);
> });
>
same, did you find a way to fix it ?