Digital Assistant and Mobile

Get Involved. Join the Conversation.

Topic

    Sharath Chandra Gavini
    How to send Postback Payload in Webhooks?Answered
    Topic posted January 28, 2019 by Sharath Chandra GaviniBronze Medal: 1,250+ Points, last edited January 29, 2019, tagged Bots, Conversational AI 
    137 Views, 3 Comments
    Title:
    How to send Postback Payload in Webhooks?
    Summary:
    Is it possible to update the variables using a postback payload from a webhook channel?
    Content:

    Hi developers,
    I am developing a custom SDK for Hangouts Chat and I want to update the variables using Postback actions.
    I referred to the official documentatiton and I am a little unclear of what needs to be done. 
    Could anyone give an example of a message payload for Postback action that updates the conversation variables?
    A full example is really appreciated. 
    This is my code snippet:

     

    let message = {
    "userId": userEmail,
    "profile": {
    "firstName": "Bob",
    "lastName": "Franklin",
    "age": 45
    },
    "messagePayload": {
    "type": "postback",
    "postback": {
    "variables": {
    "name": "Sharath Chandra"
    }
    }
    }
    }
     

     I want to update the variable "name" in my conversation with some value. Please correct my approach.

     

    UPDATE: I tried using the MessageModel library provided by the SDK but the result is still the same. Any help is very much appreciated.


    Thanks,
    Sharath Chandra Gavini.
     

    Code Snippet:

    Best Comment

    Sharath Chandra Gavini

    Hi guys,
    There was some issue with my ODA instance. The same approach worked fine with the other instance running on the same version which is weird. 
    UPDATE: The issue was I was using Platform Version 1.0(Simple Model) for Webhooks instead of 1.1 (CMM)
    Thanks.

    Comment

     

    • Sharath Chandra Gavini

      Hi guys,
      There was some issue with my ODA instance. The same approach worked fine with the other instance running on the same version which is weird. 
      UPDATE: The issue was I was using Platform Version 1.0(Simple Model) for Webhooks instead of 1.1 (CMM)
      Thanks.

    • Frank Nimphius

      Hi,

       

      just a fyi,

       

      the BotSDK has utility functions for composing messages

       

      https://github.com/oracle/bots-node-sdk#webhook-client

       

      Frank

      • Sharath Chandra Gavini

        Thanks for the response Frank,

        I tried using the SDK and even it didn't work. 

        The issue was I was using Platform Version 1.0(Simple Model) for Webhooks instead of 1.1 (CMM)

        Thanks.