-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 1.0.0 - Support for new FB messenger features
See HISTORY.md for changelog
- Loading branch information
Ricky Dunlop
committed
Jul 4, 2016
1 parent
3cf3aa4
commit 56af27f
Showing
16 changed files
with
613 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Release History | ||
|
||
## 1.0.0 | ||
|
||
### Breaking changes | ||
|
||
- `Elements#Image` moved to `Attachments#Image` | ||
- `MessengerClient#send_data` renamed to `send` | ||
- `MessengerClient#set_welcome_message removed` | ||
- `BaseMessenger#message_echoes` and `BaseMessenger#message_reads` handlers now required | ||
- Buttons now require a `button_type` parameter | ||
|
||
|
||
### New features | ||
|
||
- Support for audio, video and file attachments | ||
- Support for sender actions | ||
- Support for quick replies | ||
- Support for get started button and persistent menus | ||
- locale, timezone and gender now returned for user | ||
- Support for phone_number button types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
class BaseAttachment(object): | ||
def __init__(self, attachment_type, url): | ||
self.type = attachment_type | ||
self.url = url | ||
|
||
def to_dict(self): | ||
return { | ||
'attachment': { | ||
'type': self.type, | ||
'payload': { | ||
'url': self.url | ||
} | ||
} | ||
} | ||
|
||
|
||
class Image(BaseAttachment): | ||
def __init__(self, url): | ||
self.attachment_type = 'image' | ||
self.url = url | ||
super(Image, self).__init__(self.attachment_type, self.url) | ||
|
||
|
||
class Audio(BaseAttachment): | ||
def __init__(self, url): | ||
self.attachment_type = 'audio' | ||
self.url = url | ||
super(Audio, self).__init__(self.attachment_type, self.url) | ||
|
||
|
||
class Video(BaseAttachment): | ||
def __init__(self, url): | ||
self.attachment_type = 'video' | ||
self.url = url | ||
super(Video, self).__init__(self.attachment_type, self.url) | ||
|
||
|
||
class File(BaseAttachment): | ||
def __init__(self, url): | ||
self.attachment_type = 'file' | ||
self.url = url | ||
super(File, self).__init__(self.attachment_type, self.url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class QuickReply(object): | ||
|
||
def __init__(self, title, payload): | ||
if len(title) > 20: | ||
raise ValueError('Title cannot be longer 20 characters.') | ||
if len(payload) > 1000: | ||
raise ValueError('Payload cannot be longer 1000 characters.') | ||
|
||
self.title = title | ||
self.payload = payload | ||
|
||
def to_dict(self): | ||
return { | ||
'content_type': 'text', | ||
'title': self.title, | ||
'payload': self.payload | ||
} | ||
|
||
|
||
class QuickReplies(object): | ||
def __init__(self, quick_replies): | ||
if len(quick_replies) > 10: | ||
raise ValueError('You cannot have more than 10 quick replies.') | ||
self.quick_replies = quick_replies | ||
|
||
def to_dict(self): | ||
return { | ||
'quick_replies': [ | ||
quick_reply.to_dict() for quick_reply in self.quick_replies | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class SenderAction(object): | ||
SENDER_ACTIONS = [ | ||
'mark_seen', | ||
'typing_on', | ||
'typing_off' | ||
] | ||
|
||
def __init__(self, sender_action): | ||
if sender_action not in self.SENDER_ACTIONS: | ||
raise ValueError('Invalid sender_action provided.') | ||
self.sender_action = sender_action | ||
|
||
def to_dict(self): | ||
return { | ||
'sender_action': self.sender_action | ||
} |
Oops, something went wrong.