Sending messages

Introduction to AWS Boto in Python

Maksim Pecherskiy

Data engineer

Publishing to a Topic

response = sns.publish(
  TopicArn = 'arn:aws:sns:us-east-1:320333787981:city_alerts',
  Message = 'Body text of SMS or e-mail',
  Subject = 'Subject Line for Email'
)

SNS publishing to topic

Introduction to AWS Boto in Python

Publishing to a Topic

SNS publishing to topic SNS publishing to topic

Introduction to AWS Boto in Python

Publishing to a Topic

SNS publishing to topic SNS publishing to topic

Introduction to AWS Boto in Python

Sending custom messages

num_of_reports = 137

response = client.publish(
  TopicArn = 'arn:aws:sns:us-east-1:320333787981:city_alerts',
  Message = 'There are {} reports outstanding'.format(num_of_reports),
  Subject = 'Subject Line for Email'
)
Introduction to AWS Boto in Python

Sending a single SMS

response = sns.publish(
  PhoneNumber = '+13121233211',
  Message = 'Body text of SMS or e-mail'
)

Senging single SMS

Introduction to AWS Boto in Python

Not a good long term practice

  • One-off texts = getting stuff done
  • Topics and subscribers = maintenability
Introduction to AWS Boto in Python

Publish to Topic vs Single SMS

Publish to a topic

  • Have to have a topic
  • Our topic has to have subscriptions
  • Better for multiple receivers
  • Easier list management

Publish To Topic

Send a single SMS

  • Don't need a topic
  • Don't need subscriptions
  • Just sends a message to a phone number
  • Email option not available

Send single SMS

Introduction to AWS Boto in Python

Review

Publish to a topic

response = sns.publish(
  TopicArn = 'arn:aws:sns:us-east-1:320333787981:city_alerts',
  Message = 'Body text of SMS or e-mail',
  Subject = 'Subject Line for Email'
)

Send a single SMS

response = sns.publish(
  PhoneNumber = '+13121233211',
  Message = 'Body text of SMS or e-mail'
)
Introduction to AWS Boto in Python

Let's practice!

Introduction to AWS Boto in Python

Preparing Video For Download...