Search code examples
pythonfacebook-messengerfacebook-messenger-bot

create "get started button" Facebook messenger on python


I am new to messenger platform, I did search a lot on the internet how to make a "get started" button on messenger in python but there is no answer. Below is my code:

def send_get_started(bot,recipient_id):
button = {
    "get_started":{
        "payload" : "first_coming"
    }
}
bot.send_raw(button)

the send_raw function here I get from bot.py in pymessenger2 on python which is here (also the code below)

def send_raw(self, payload):
    request_endpoint = '{0}/me/messages'.format(self.graph_url)
    response = requests.post(
        request_endpoint,
        params=self.auth_args,
        data=json.dumps(payload, cls=AttrsEncoder),
        headers={'Content-Type': 'application/json'})
    result = response.json()
    return result

Of course it did not work, I think I misunderstand somewhere, could somebody show me my problem? Thanh you so much.


Solution

  • The endpoint should be: https://graph.facebook.com/v2.6/me/messenger_profile

    You could see this in the reference: Get Started Reference