GitHub integration of Advanced Cloud Code - part 2
Tags: twilio, npm, tutorial, beginners
Published: 2019-10-25 11:03:59

### How to set up Twilio for local development

In the [first part](https://blog.sashido.io/github-integration-of-advanced-cloud-code-part-1) of this tutorial, we showed you how to make npm package integrations directly into your Advanced Cloud Code. But let’s say you want to test something on your computer before deploying it on SashiDo’s Cloud Code. This tutorial is for Mac OS X (for other OS should something similar)

First, you should install nvm (Node Version Manager - Simple bash script to manage multiple active node.js versions). Here’s an explanation how to do it: [link](https://github.com/creationix/nvm). Command is
```
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
```

You should also have Node.js installed, you can download it from [here](https://nodejs.org/en/download/package-manager/). But we’ll show how to do it with the NVM. Run in your terminal the following command:
```
nvm install v6.2.1
```

Clone the repository, if you haven’t done it yet. 
```
git clone git@github.com:parsegroundapps/pg-app-yourapp-id.git
```

Install twilio, here is explained how to do it [link](https://www.npmjs.com/package/twilio). We suggest you to use the command:
```
npm install --save twilio
```

Command --save will automatically write it in package.json. It’s a good practice to use it, because sometimes a programmer forgets to add the dependency and to push it to the server. The code won’t work as a result. 

You should add node_modules directory to the git ignore file, because they’ll be installed on the server automatically by SashiDo.
```
echo 'node_modules' >> .gitignore
```

Let’s create a new file that will keep our test code: twilio.js in the cloud directory. Don’t forget to require it in main.js, otherwise, it’ll not work. 

Let’s write a simple function in twilio.js, which will send a SMS to a number by your choice.
<script src="https://gist.github.com/pkeremidchieva/273a9acb043f0e28a6a95b26582313e3.js"></script>

You can find 'ACCOUNT_SID' and 'AUTH_TOKEN'  in [Twilio’s Dashboard](https://www.twilio.com/login), here is [Twilio’s  documentation](https://www.twilio.com/docs/) in case you need it. 

In order to test, you’ll need some database. You can use your application’s database. Go to SashiDo’s Dashboard, App Settings -> Security & Keys -> Database URL. Copy & Paste in index.js:

<script src="https://gist.github.com/pkeremidchieva/03259795dbf992473a81efc1215e31b3.js"></script>

Run Parse Server in Node.js with command
node index.js

Open a new tab of the terminal and write the following POST request to do the test:
```
curl -X POST \
	-H 'X-Parse-Application-Id: myAppId' \
	-H 'X-Parse-REST-API-Key: key' \
	http://localhost:1337/1/functions/inviteWithTwilio
```

Check the phone for the results, if you followed this tutorial correctly, you should get the SMS: 

![](https://media-blog.sashido.io/content/images/2016/10/img2-4.png)

If you’re happy with the results, it’s time to deploy the code. Git add, git commit, git push your changes
```
git add .
git commit -am 'Add twillio integration'
git push
```
<br />
**Now you can smoothly enjoy building complex apps with the power, given by SashiDo and Advanced Cloud Code.** If you have any difficulties or need help - reach us at support@sashido.io.


Happy coding :)