Parse is a seriously awesome platform for building mobile apps and we’re teaming up to make it even easier for mobile developers to access the Twilio API through Parse’s Cloud Code. Today Parse introduces the Twilio Cloud Module, one of many upcoming Parse integrations on their new Cloud Modules product, all making it simple to use third party services when building your mobile apps.
Mobile developers are using Twilio in incredible ways, like the drawing collab app DrawChat that uses phone number verification to protect its users. Or the social app Path that uses Twilio SMS for mobile app distribution. Whatever Twilio feature you want to add to your mobile app, now you can easily integrate within Parse.
We asked Parse Engineer Mattieu Gamache-Asselin to give us an example of how you could use Twilio and Parse together, and he wrote this super tutorial for getting started. Follow Mattieu on Twitter @mattieuga, and if you have questions get in touch with the Parse team at email@example.com
Using Twilio with Parse
In this short tutorial, we’ll take a look at a sample Parse and Twilio application. This small app allows you to send SMSs to phone numbers stored on Parse or in the device’s address book. The entire application require no servers, the SMSs are sent using Twilio, and the data storage and server side logic is handled by Parse. Note that we won’t have the chance to go through all of the code in this blog post, but you can download the entire source for this project on github.
In the iOS application, we present a table view that loads friends from the
Friend table in your Parse app. Each of these friends have a phone number associated with them. When we tap on one, we make a call to a Cloud Function.
In this Cloud Function we start by initializing the Twilio Cloud Module with our Twilio account sid and auth token. We then call the sendSMS function and provide the body parameters (as defined by the Twilio API) as well as a success and failure callback function. All of this code is located in the main.js file which is uploaded to Parse using the Cloud Code tool.
And that’s it! The friend you selected will receive an invitation SMS and no servers are needed. Download the app from the github repository and try it out for yourself! You’ll need both a Parse account (which you can create here) as well as a Twilio account and you’ll need to set your keys and tokens as described in the readme included with the app.
- Twilio Cloud Module: https://www.parse.com/docs/cloud_modules_guide#twilio
- Parse: https://www.parse.com
- Twilio and Parse Sample App: https://github.com/ParsePlatform/TwilioCloudModule/