Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ This wrapper has the following functions:
* send_message(recipient_id, message)
* send_generic_message(recipient_id, elements)
* send_button_message(recipient_id, text, buttons)
* send_list_message(recipient_id, text, list_items)
* send_quick_replies(recipient_id, message, quick_replies)
* send_attachment(recipient_id, attachment_type, attachment_path)
* send_attachment_url(recipient_id, attachment_type, attachment_url)
* send_image(recipient_id, image_path)
Expand Down Expand Up @@ -95,7 +97,6 @@ bot.send_image_url(recipient_id, image_url)

* Structured Messages
* Receipt Messages
* Quick Replies
* Airlines
* Tests!

Expand Down
28 changes: 28 additions & 0 deletions pymessenger/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,34 @@ def send_button_message(self, recipient_id, text, buttons, notification_type=Not
}
}
}, notification_type)

def send_list_message(self, recipient_id, text, list_items,
notification_type=NotificationType.regular):

return self.send_generic_message(recipient_id,
list_items, notification_type)

def send_quick_replies(self, recipient_id, message, quick_replies,
notification_type=NotificationType.regular):
"""Send a quick reply to the specified recipient wi
th specific type of quick reply.
https://developers.facebook.com/docs/messenger-p
latform/reference/send-api/quick-replies/
Input:
recipient_id: recipient id to send to
text: Text to ask for something
type: content_type. eg: text, location,
user_phone_number, user_email
title: Title of quick reply
payload: Postback payload
img_url: Icon URL for quick Reply suggestion
Output:
Response from API as <dict>
"""
return self.send_message(recipient_id, {
"text": message,
"quick_replies": quick_replies
}, notification_type)

def send_action(self, recipient_id, action, notification_type=NotificationType.regular):
"""Send typing indicators or send read receipts to the specified recipient.
Expand Down