Skip to main content

SMS framework: Amazon SNS provider

Project description

Build Status Pythons

SMSframework Amazon SNS Provider

Amazon SNS Provider for smsframework.

In the Amazon Console, you can specify

Getting started:

  1. 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.

  2. 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.

  3. Click "get started"

  4. 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

  5. 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.

  6. 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 and Secret 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 id
  • secret_access_key: str: AWS secret access key
  • region_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smsframework-amazon-sns-0.0.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smsframework_amazon_sns-0.0.2-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file smsframework-amazon-sns-0.0.2.tar.gz.

File metadata

  • Download URL: smsframework-amazon-sns-0.0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.7

File hashes

Hashes for smsframework-amazon-sns-0.0.2.tar.gz
Algorithm Hash digest
SHA256 823f08621324a2ab9fbb0485593e1f0f16fbfb3b1cfec474d4e4f8e6f5785acc
MD5 ffec026c44c6ae9eb299e5ff612fe08b
BLAKE2b-256 922ed257e4ecaaff801c9ff7db775674b711c7a5277c080a078255cb2d0b16db

See more details on using hashes here.

File details

Details for the file smsframework_amazon_sns-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: smsframework_amazon_sns-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.7

File hashes

Hashes for smsframework_amazon_sns-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7ccbe666782621cc19478934dd71a75881957768eca478de4d6158e41603a05a
MD5 e6edcad36fefa1265d03cef90b6a2a5b
BLAKE2b-256 f6848e2ab17930e7e9daa3aefbad576c2b7051b17257b88c43b5b5d9c3e4f39e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page