SMS framework: Amazon SNS provider
Project description
SMSframework Amazon SNS Provider
Amazon SNS Provider for smsframework.
In the Amazon Console, you can specify
Getting started:
-
Create an AWS account, if you don't have one: https://aws.amazon.com/. You will have 100 messages you can send for free. You'll need to give them your debit card, but it's free.
-
Sign in to the AWS Management Console: https://console.aws.amazon.com/sns/v2/home, choose (or search for) "SNS" in the menu at the top.
-
Click "get started"
-
Choose your region (top right, small drop-down).
Note: some regions do not support SMS messages; choose one that does. You'll know it when you see "Text messaging (SMS)" in the left menu.
Copy the region identifier from the URL:
home?region=eu-west-1#/home
->eu-west-1
. You will use it with this library -
In the left menu, choose "Text messaging (SMS)", go to "Text messaging preferences", and set it up.
Here, you can specify whether you want low-cost messaging ("promotional"), or reliable delivery ("transactional"). These preferences take effect for every SMS message that you send from your account, but you can override some of them when you send an individual message.
Also, specify your default SenderID.
-
Click at your login at the top, choose "My Security credentials". Choose "Access keys", click on the "Create new access key" button. These are the credentials you're going to use with this library:
Access Key ID
andSecret Access Key
.
Installation
Install from pypi:
$ pip install smsframework_amazon_sns
To receive SMS messages, you need to ensure that Flask microframework is also installed:
$ pip install smsframework_amazon_sns[receiver]
Initialization
from smsframework import Gateway
from smsframework_amazon_sns import AmazonSNSProvider
gateway = Gateway()
gateway.add_provider('amazon', AmazonSNSProvider,
access_key='AAABBB111222CCCDDDEE',
secret_access_key='fOAPpu78gZ6/HSJKCHqFj0xOJIFDt9mKQjkR+XTt',
region_name='eu-west-1',
)
Config
Source: /smsframework_amazon_sns/provider.py
access_key: str
: AWS access key idsecret_access_key: str
: AWS secret access keyregion_name: str
: AWS region name
Example
from smsframework import OutgoingMessage
# Send a regular, low-cost message (when the default message type is "promotional")
gateway.send(OutgoingMessage('+19998887766', 'Test'))
# escalate=True sends a 'transactional' message: Amazon will use reliable delivery
gateway.send(OutgoingMessage('+19998887766', 'Test').options(senderId='kolypto', escalate=True))
Supported Options
.options(senderId='kolypto')
: Sets an alpha-numeric SenderID.options(escalate=True)
: Amazon will optimize the delivery to achieve the highest reliability.
Provider-Specific Parameters
Provider-specific sending params:
MaxPrice: float
: The maximum amount in USD that you are willing to spend to send the SMS message.
Example:
from smsframework import OutgoingMessage
gateway.send(OutgoingMessage('+123', 'hi').params(MaxPrice=0.15))
Limitations
Incoming messages are currently not supported.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for smsframework-amazon-sns-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 823f08621324a2ab9fbb0485593e1f0f16fbfb3b1cfec474d4e4f8e6f5785acc |
|
MD5 | ffec026c44c6ae9eb299e5ff612fe08b |
|
BLAKE2b-256 | 922ed257e4ecaaff801c9ff7db775674b711c7a5277c080a078255cb2d0b16db |
Hashes for smsframework_amazon_sns-0.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ccbe666782621cc19478934dd71a75881957768eca478de4d6158e41603a05a |
|
MD5 | e6edcad36fefa1265d03cef90b6a2a5b |
|
BLAKE2b-256 | f6848e2ab17930e7e9daa3aefbad576c2b7051b17257b88c43b5b5d9c3e4f39e |