You know what they say, ain’t no party like a Neptyne Party! In this example, we’re building a simple application to send out party invitations to a group of guests. We’ll use Twilio to send out the invitations, but there are many alternative libraries that will work similarly. We’ll also be using Neptyne’s built in secret management to keep track of our Twilio keys. You can follow along by cloning this tyne.
After creating a Twilio account (which should take less than 2 minutes!), you can find your account_sid and auth_token at twilio.com/console. You’ll also need to create a phone number to send the text messages from and add that as a secret as well! Neptyne’s secret management nt.get_secret will protect your keys from anyone you share the tyne with, but they’ll always be available in this Tyne for you to use to make API calls. In addition to inserting the keys when the code executes, you can also open up the secret manager from the Neptyne men to access or edit the values. Once your keys are setup you can test out the send_message function with a sample message and your phone number to verify.
You can also follow the rest of this example without creating a twilio account. Just comment out lines containing the calls to nt.get_secret and the call to send_message.
Now that we can send messages, the rest of the application is set up to track our guest list in the B-D columns. The button in E4 triggers the invite_all_guests function which loops through the guest list and looks for guests with phone numbers who haven’t been invited yet.
We send the invite with Twilio and mark the ‘invited’ column as true.
Looking for an extra challenge? Try to modify this Tyne to allow your guests to RSVP. Using the twilio message search API we can filter for messages from a specific number to get someone’s response! https://www.twilio.com/docs/sms/tutorials/how-to-retrieve-and-modify-message-history-python.