API
Tim Phillips edited this page Jun 3, 2018
·
4 revisions
Messages also allows the user to create and send any message with a simple API interface.
send(msg_type, send_async=False, *args, **kwargs)
- msg_type: (str) the message type to send, i.e. "email", "twilio", etc.
- send_async: (bool) initially set to False, set to True to send message asynchronously.
- **kwargs: (dict) parameters specific to each message type.
Given a message type and a dictionary of kwargs, a message can be easily sent, like so:
# program or script *.py file
from messages import send
kwargs = {
'to': 'you@there.com',
'subject': 'Email Test!',
'body': 'This is an email message!',
'profile': 'myProfileName',
}
send('email', **kwargs)
Thought is being put into making this module more robust and capable of using multiple message types with a single call to the API. For example, ideally one would be able to send multiple messages, like so:
# program or script file *.py
from messages import send
kwargs = {
'to': ['you@there.com', '+19998675309'],
'body': 'buy more bitcoin!',
'profile': 'myProfileName'
}
send(['email', 'twilio'], send_async=True, **kwargs)
- About
- Contributing Code
- TODO List
- Architecture & Design
- Installation
- Usage
- Message Types: