Skip to main content

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.

Metadata

Release files for smsframework-amazon-sns 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smsframework-amazon-sns 0.0.2
File Size Uploaded
smsframework-amazon-sns-0.0.2.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smsframework-amazon-sns 0.0.2
File Interpreter ABI Platform
smsframework_amazon_sns-0.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 11.4 kB

Release files / smsframework-amazon-sns-0.0.2.tar.gz

Download URL smsframework-amazon-sns-0.0.2.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
823f08621324a2ab9fbb0485593e1f0f16fbfb3b1cfec474d4e4f8e6f5785acc
BLAKE2b-256 checksum
How to use checksums
922ed257e4ecaaff801c9ff7db775674b711c7a5277c080a078255cb2d0b16db
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / smsframework_amazon_sns-0.0.2-py2.py3-none-any.whl

Download URL smsframework_amazon_sns-0.0.2-py2.py3-none-any.whl
Size 5.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7ccbe666782621cc19478934dd71a75881957768eca478de4d6158e41603a05a
BLAKE2b-256 checksum
How to use checksums
f6848e2ab17930e7e9daa3aefbad576c2b7051b17257b88c43b5b5d9c3e4f39e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page