def click_product_payload(payload, event): page.typing_on(event.sender_id) quick_replies = [{ 'title': 'Loan', 'payload': 'LOAN_ACTION' }, { 'title': 'Saving', 'payload': 'SAVING_ACTION' }] page.send(event.sender_id, "What kind of product do you prefer?", quick_replies=quick_replies, metadata="DEVELOPER_DEFINED_METADATA", notification_type=NotificationType.REGULAR) page.typing_off(event.sender_id)
def start_payload_callback(payload, event): sender_id = event.sender_id page.typing_on(sender_id) page.send( sender_id, profile.last_name + ", welcome! Nice to see you here :). I'm PhillipBot. You can ask me with quick reply pop up below and you can either choose option in right menu." ) d = json.dumps({ "recipient": { "id": sender_id }, "message": { "attachment": { "type": "template", "payload": { "template_type": "button", "text": "Are you read to do this? You'll need to log in your customer's account so I can help you do more things.", "buttons": [{ "type": "account_link", "url": "https://ebotmessenger.herokuapp.com/login/authorize" }, { "title": "Term of use", "type": "web_url", "url": "www.google.com" }, { "title": "Help", "type": "postback", "payload": "HELP_PAYLOAD" }] } } } }) requests.post(url=url_messenger_message, params=params, headers=headers, data=d) page.typing_off(sender_id) print("Let's start! %s", sender_id)
def click_loan_action(payload, event): page.typing_on(event.sender_id) quick_replies = [{ 'title': 'Business Loan', 'payload': 'LOAN_ACTION' }, { 'title': 'Consumption Loan', 'payload': 'SAVING_ACTION' }, { 'title': 'Home Improvment Loan', 'payload': 'SAVING_ACTION' }, { 'title': 'Agriculture Loan', 'payload': 'SAVING_ACTION' }, { 'title': 'SME Loan', 'payload': 'SAVING_ACTION' }, { 'title': 'Working Captital Loan', 'payload': 'SAVING_ACTION' }, { 'title': 'Personal Loan', 'payload': 'SAVING_ACTION' }, { 'title': 'Solar Loan', 'payload': 'SAVING_ACTION' }, { 'title': 'Education Loan', 'payload': 'SAVING_ACTION' }, { 'title': 'Community Bank Loan', 'payload': 'SAVING_ACTION' }, { 'title': 'Loan Payment Service Via Truemoney Agent', 'payload': 'SAVING_ACTION' }] page.send(event.sender_id, "What kind of product do you prefer?", quick_replies=quick_replies, metadata="DEVELOPER_DEFINED_METADATA", notification_type=NotificationType.REGULAR) page.typing_off(event.sender_id)
def click_loan_action(payload, event): page.send(event.sender_id, "saving action") print 'test'
def click_check_balance_payload(payload, event): page.send(event.sender_id, 'click check balance')
def click_help_payload(payload, event): page.send(event.sender_id, "contact us")
def click_help_payload(payload, event): page.send(event.sender_id, "clicked help")