|
7 | 7 | from messagebird.group import Group, GroupList |
8 | 8 | from messagebird.hlr import HLR |
9 | 9 | from messagebird.message import Message |
| 10 | +from messagebird.mms import MMS |
10 | 11 | from messagebird.voicemessage import VoiceMessage |
11 | 12 | from messagebird.lookup import Lookup |
12 | 13 | from messagebird.verify import Verify |
@@ -110,6 +111,31 @@ def message_delete(self, id): |
110 | 111 | """Delete a message from the dashboard.""" |
111 | 112 | self.request_plain_text('messages/' + str(id), 'DELETE') |
112 | 113 |
|
| 114 | + def mms_create(self, originator, recipients, body, mediaUrls, subject = None, reference = None, scheduledDatetime = None): |
| 115 | + ''' Send bulk mms. |
| 116 | +
|
| 117 | + Args: |
| 118 | + originator(str): name of the originator |
| 119 | + recipients(str/list(str)): comma seperated numbers or list of numbers in E164 format |
| 120 | + body(str) : text message body |
| 121 | + mediaUrl(str) : list of URL's of attachments of the MMS message. |
| 122 | + subject(str) : utf-encoded subject |
| 123 | + reference(str) : client reference text |
| 124 | + scheduledDatetime(str) : scheduled date time in RFC3339 format |
| 125 | + Raises: |
| 126 | + ErrorException: On api returning errors |
| 127 | +
|
| 128 | + Returns: |
| 129 | + MMS: On success an MMS instance instantiated with succcess response |
| 130 | + ''' |
| 131 | + if isinstance(recipients,list): |
| 132 | + recipients = ','.join(recipients) |
| 133 | + if isinstance(mediaUrls,str): |
| 134 | + mediaUrls = [mediaUrls] |
| 135 | + params = locals() |
| 136 | + del(params['self']) |
| 137 | + return MMS().load(self.request('mms', 'POST', params)) |
| 138 | + |
113 | 139 | def voice_message(self, id): |
114 | 140 | "Retrieve the information of a specific voice message." |
115 | 141 | return VoiceMessage().load(self.request('voicemessages/' + str(id))) |
@@ -250,6 +276,6 @@ def conversation_list_webhooks(self, limit=10, offset=0): |
250 | 276 | def conversation_read_webhook(self, id): |
251 | 277 | uri = CONVERSATION_WEB_HOOKS_PATH + '/' + str(id) |
252 | 278 | return ConversationWebhook().load(self.request(uri, 'GET', None, CONVERSATION_TYPE)) |
253 | | - |
| 279 | + |
254 | 280 | def _format_query(self, limit, offset): |
255 | 281 | return 'limit=' + str(limit) + '&offset=' + str(offset) |
0 commit comments