DEV Community

loading...
Cover image for GitHub integration of Advanced Cloud Code - part 1
SashiDo.io

GitHub integration of Advanced Cloud Code - part 1

veselinastaneva profile image Vesi Staneva Originally published at blog.sashido.io ・3 min read

Setup of Twilio package tutorial

Building more complex apps without a lot of knowledge about back-ends and infrastructure sounds difficult, but we believe in Parse’s vision for letting developers create any app effortlessly. When we first launched early access for SashiDo, most of our lovely users asked for Advanced Cloud Code and we do understand why - it’s an essential feature, because it’s flexible, allows you to write Express applications and use different packages such as Mashape, Mailgun etc. This means that Advanced Cloud Code gives you the opportunity to build more complex applications with a minimum of logic and no struggle. You only need to integrate a Cloud module into your SashiDo GitHub repo and you can easily use third-party services and libraries which will help you to create the dream product.
Those of you who haven’t used external packages will surely enjoy the power, given by them, and those of you who don’t know how to set them up with SashiDo, will see how easy and straight-forward it is.

This tutorial will show you how to setup Twilio ( an awesome API providing video and voice calls, send & receive SMS, MMS, authentication service for more secure apps ) into your Advanced Cloud Code. You can do the same with every Cloud module and the same technique will work with Android, iOS and any other platforms, supported by SashiDo. So let’s get started!

We’ll divide this tutorial into two parts: the first will show how to do the integration on the Cloud Code of SashiDo, and the second will describe how to develop locally on your pc (in case you want to do some testing before deployment).

Setup of Twilio on SashiDo’s Cloud Code

You already know about your private GitHub repo, provided by SashiDo with your Cloud Code (if you’ve missed this important info, read more here.
Here is a helpful article about how to set up Git. Clone the repository, if you haven’t done it yet.

Find in the main directory file package.json. In package.json you can add all npm packages you want to use in your app. According to our tutorial, this will be Twilio, but the same principle will apply for other npm packages.

P.S. Take a look at line 14.

We’ll create a new JavaScipt file named twilio.js and require it in the main.js file. Every Cloud Code file should be included there, otherwise, it will not work.

Let’s write a simple function in twilio.js in the cloud directory, which will send an SMS to a number by your choice.

You can find 'ACCOUNT_SID' and 'AUTH_TOKEN' in Twilio’s Dashboard, here is Twilio’s documentation in case you need it.

We’re ready with the preparations, it’s time to deploy our code.

git add .
git commit -am 'Add twillio integration'
git push
Enter fullscreen mode Exit fullscreen mode

Keep in mind that every trigger causes a deploy in your application, so you don’t have to do anything about it.

Go to SashiDo’s Dashboard -> Core -> Cloud Code and wait until the code is finished deploying.

Now it’s time to test if our integration is successful: go to Core -> Api Console, make a POST request with function twilio.js and press Send Query.

Let’s see the result on the phone :)

If you followed the steps correctly, you should have received the SMS. In the second of the tutorial, we’ll learn how to set up npm package for local development.

GitHub integration of Advanced Cloud Code part 2

If you have any difficulties or need help - reach us at support@sashido.io.

Happy coding :)

Discussion (2)

Collapse
philnash profile image
Phil Nash

Hey! This is really cool that you can get going with Twilio (or any!) development in just your browser. I appreciate part 2 shows you how to do this on your local machine, but I love this simplicity. Thanks for sharing.

Collapse
veselinastaneva profile image
Vesi Staneva Author

Thank you for your kind words! Many of our users choose to implement Twilio and thus we thought why not make it even easier for them with a small example. :)

Forem Open with the Forem app