Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Send SMS with AWS SNS using Python

Sending SMS's with AWS SNS:

import boto3
sms_number='+27000000000'

sns = boto3.Session(profile_name='default', region_name='eu-west-1').client('sns')

response = sns.publish(
    PhoneNumber=sms_number, 
    Message='testing', 
    MessageAttributes={
        'AWS.SNS.SMS.SenderID': {
            'DataType': 'String',
            'StringValue': '123'
        },
        'AWS.SNS.SMS.SMSType': {
            'DataType': 'String',
            'StringValue': 'Transactional'
        }
    }
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment