Weird error with Facebook Messenger Platform/bot Welcome Confugration

后端 未结 4 1849
孤独总比滥情好
孤独总比滥情好 2021-02-05 10:35

I\'m getting a weird error while configuring welcome message for my Messenger bot. I\'ve been using the same code (as shown below) and it has just been working fine until last n

相关标签:
4条回答
  • 2021-02-05 10:43

    I get the same issue and fix it. I think your json of request is

    let messageData = {
    "setting_type":"call_to_actions",
    "thread_state":"new_thread",
    "call_to_actions":[
      {
        "payload":"welcome_payload"
      }
    ]
    }
    request({
        url: 'https://graph.facebook.com/v2.6/me/thread_settings',
        qs: {access_token:token},
        method: 'POST',
        json: {
            messageData
        }
    }
    

    but it will not work and log will say you have no "setting_type" = =a try this one

      request({
            url: 'https://graph.facebook.com/v2.6/me/thread_settings',
            qs: {access_token:token},
            method: 'POST',
            json: {
                setting_type:"call_to_actions",
                thread_state:"new_thread",
                 call_to_actions:[
                  {
                    "payload":"welcome_payload"
                  }
                 ]
            }
        }
    

    it work for me.

    0 讨论(0)
  • 2021-02-05 10:45

    The docs are now updated, you need to define your payload in payload parameter now (a UTF-8 encoded string), eg:

    "call_to_actions":[
        {
          "payload":"USER_DEFINED_PAYLOAD"
        }
    ]
    
    0 讨论(0)
  • 2021-02-05 10:45

    Docs updated:

    https://developers.facebook.com/docs/messenger-platform/thread-settings/greeting-text

    Example:

    curl -X POST -H "Content-Type: application/json" -d '{
      "setting_type":"greeting",
      "greeting":{
        "text":"Welcome to My Company!"
      }
    }' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"
    
    0 讨论(0)
  • 2021-02-05 10:59

    This error was due to an API change.

    New call:

    curl -X POST -H "Content-Type: application/json" -d '{
      "setting_type":"call_to_actions",
      "thread_state":"new_thread",
      "call_to_actions":[{
        "payload":"START"
      }]
    }' "https://graph.facebook.com/v2.6/<PAGE_ID>/thread_settings?access_token=<PAGE_TOKEN>"
    

    Just add a payload like {"payload":"START"}

    If a user press the "Getting started" button, you receive this payload in your messageHandler (webhook). Check if $incomingMessage == "START" and send back your structured message, or whatever you want.

    Messages like before are not supported anymore.

    Bug report: https://developers.facebook.com/bugs/1751749508372552/

    0 讨论(0)
提交回复
热议问题