Skip to content

Instantly share code, notes, and snippets.

@ruanbekker
Created October 6, 2021 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruanbekker/f23a31b7a267fb71b38e725e6b1692da to your computer and use it in GitHub Desktop.
Save ruanbekker/f23a31b7a267fb71b38e725e6b1692da to your computer and use it in GitHub Desktop.
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