Envoi de messages

Introduction à AWS Boto en Python

Maksim Pecherskiy

Data engineer

Publier vers un sujet

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'
)

Publication SNS vers un sujet

Introduction à AWS Boto en Python

Publier vers un sujet

Publication SNS vers un sujet Publication SNS vers un sujet

Introduction à AWS Boto en Python

Publier vers un sujet

Publication SNS vers un sujet Publication SNS vers un sujet

Introduction à AWS Boto en Python

Envoi de messages personnalisés

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 à AWS Boto en Python

Envoyer un SMS unique

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

Envoi d'un SMS unique

Introduction à AWS Boto en Python

Pas une bonne pratique à long terme

  • SMS ponctuels = efficacité immédiate
  • Sujets et abonnés = maintenabilité
Introduction à AWS Boto en Python

Sujet vs SMS unique

Publier vers un sujet

  • Il faut un sujet
  • Le sujet doit avoir des abonnements
  • Mieux pour plusieurs destinataires
  • Gestion des listes facilitée

Publier vers un sujet

Envoyer un SMS unique

  • Pas besoin de sujet
  • Pas besoin d'abonnements
  • Envoie simplement un message à un numéro
  • Option e-mail non disponible

Envoyer un SMS unique

Introduction à AWS Boto en Python

Récapitulatif

Publier vers un sujet

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'
)

Envoyer un SMS unique

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

Passons à la pratique !

Introduction à AWS Boto en Python

Preparing Video For Download...