LoslegenKostenlos loslegen

Sending a single SMS message

Elena asks Sam outside of work (per regulation) to send some thank you SMS messages to her largest donors.

Sam believes in Elena and her goals, so she decides to help.

She decides writes a quick script that will run through Elena's contact list and send a thank you text.

Since this is a one-off run and Sam is not expecting to alert these people regularly, there's no need to create a topic and subscribe them.

Sam has created the boto3 SNS client and stored it in the sns variable. The contacts variable contains Elena's contacts as a DataFrame.

Help Sam put together a quick hello to Elena's largest supporters!

Diese Übung ist Teil des Kurses

Introduction to AWS Boto in Python

Kurs anzeigen

Anleitung zur Übung

  • For every contact, send an ad-hoc SMS to the contact's phone number.
  • The message sent should include the contact's name.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Loop through every row in contacts
for idx, row in contacts.iterrows():
    
    # Publish an ad-hoc sms to the user's phone number
    response = sns.____(
        # Set the phone number
        ____ = str(row['Phone']),
        # The message should include the user's name
        ____ = 'Hello {}'.____(row['Name'])
    )
   
    print(response)
Code bearbeiten und ausführen