किसी ने मुझे बता सकते हैं फेसबुक chatbot बटन तत्व में 'पेलोड' फ़ील्ड क्या है? मैं बॉट विकास के लिए नया हूँ। यदि आप एक उदाहरण भी प्रदान कर सकते हैं बहुत अच्छा होगा।
फेसबुक चैट बॉट पेलोड क्षेत्र क्या है?
'पेलोड' फ़ील्ड को उपयोगकर्ता परिभाषित क्षेत्र जो कोई गतिविधि जब भी इस पेलोड के साथ एक पोस्टबैक प्राप्त होता है कॉल करने के लिए सक्षम बनाता है।
उदाहरण के लिए; अगर मैं अपने बॉट कि 2 बटन होते हैं में लगातार मेनू बनाने के लिए: 'घर' और 'संपर्क', और उनमें से प्रत्येक के लिए पेलोड बटन के नाम के समान है। एक उपयोगकर्ता 'होम' बटन पर क्लिक करता है, एक पोस्टबैक पेलोड 'होम' के साथ भेजा जाता है। उस मामले में आप एक एक्शन से उस बोट की 'होम' भाग को उपयोगकर्ता लेता है बना सकते हैं।
: Postbacks और पेलोड के बारे में अधिक के लिए, पर जाएँ https://developers.facebook.com/docs/messenger-platform/send-api-reference/postback-button https://developers.facebook.com/docs/messenger-platform / webhook-संदर्भ / पोस्टबैक प्रतिक्रिया प्राप्त हुई
आपका मुख्य 'पोस्ट' समारोह पोस्टबैक प्रबंधित करने में एक समारोह बनाना सुनिश्चित करें। नीचे दिए गए कोड पायथन में एक बॉट ट्यूटोरियल से है
# 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 ###













