zendesk/sunshine-conversations-javascript

Postback not working

kazuooooo opened this issue · 2 comments

Hi, I want to use smooch post back.
I try sample following with this post backs button

exports.sendMessage = function (appUserId, params) {
  const params = {
    text: "expect post back",
    role: 'appMaker',
    type: 'text',
    actions: [
      {
        type: 'postback',
        text: 'Postback Button Label',
        payload: 'PAYLOAD_HERE'
      }
    ]
  }
  smooch.appUsers.sendMessage(appUserId, params)
    .then((response) => {
      console.log('Smooch API RESPONSE:\n', response);
    })
    .catch((err) => {
      console.log('Smooch API ERROR:\n', err);
    });
};

When I tapped postback button, a message is shown, but no postback request fired.
(Is it right that endpoint is my app webhook?)

I use facebook messenger and smooch-core-js is version 5.6.0

Let me double check that I understand the situation. So you are sending a postback with the code above, it appears as a button in Facebook Messenger. Tapping the button in Facebook causes the message to echo back in the conversation, confirming the user's selection. Then, you are not receiving a postback webhook from Smooch. Is that correct?

Are you able to receive other webhook events for your app? Is your webhook subscribed to the postback trigger?

I had similar issue. It was due to page not subscribed to events. By default it is only messaging you need to explicitly set

Edit Page Subscriptions
Post back -enable