Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendListTemplate : Error PostBack Buttons #163

Open
Guivers opened this issue Nov 8, 2018 · 1 comment
Open

sendListTemplate : Error PostBack Buttons #163

Guivers opened this issue Nov 8, 2018 · 1 comment

Comments

@Guivers
Copy link

Guivers commented Nov 8, 2018

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);
> });
> 
@zaidfadhil
Copy link

zaidfadhil commented Nov 27, 2018

same, did you find a way to fix it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants