Mi facebook chat-bot hasznos területen?

szavazat
0

Tud valaki magyarázni nekem, mi az a „hasznos teher” mező facebook chatbot gomb elem? Új vagyok a bot fejlődését. Jó lenne, ha példát is.

A kérdést 12/10/2016 07:44
a forrás felhasználó
Más nyelveken...                            


1 válasz

szavazat
1

A „hasznos teher” mező a felhasználó által meghatározott területen, amely lehetővé teszi, hogy hívja a cselekvés, amikor egy postback ezzel hasznos érkezik.

például; Ha létrehozok egy állandó menü én bot, amely 2 gomb: „Home” és a „Kapcsolat” és a hasznos mindegyikre ugyanaz, mint a neve a gombot. Amikor a felhasználó rákattint a „Home” gombot, a visszaküldési elküldi a hasznos teher „Home”. Ebben az esetben létrehozhat egy műveletet, amelyet a felhasználó a „Home” része a bot.

További mintegy postbacks és hasznos, megy: https://developers.facebook.com/docs/messenger-platform/send-api-reference/postback-button https://developers.facebook.com/docs/messenger-platform / webhook-referencia / postback-received

győződjön meg róla, hogy hozzon létre egy funkciót a fő „post” funkció, amely kezeli a postback. Az alábbi kód származik bot bemutató Python

# Post function to handle facebook messages
def post(self, request, *args, **kwargs):
    # converts the text payload into a python dictionary
    incoming_message = json.loads(self.request.body.decode('utf-8'))
    # facebook recommends going through every entry since they might send
    # multiple messages in a single call during high load
    for entry in incoming_message['entry']:
        for message in entry['messaging']:
            # check to make sure the received call is a message call
            # this might be delivery, optin, postback for other events

            if 'message' in message:
                pprint(message)
                ### add here the rest of the code that will be handled when the bot receives a message ###

            if 'postback' in message:
                # print the message in terminal
                pprint(message)
                ### add here the rest of the code that will be handled when the bot receives a postback ###
Válaszolt 20/10/2016 13:59
a forrás felhasználó

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more