Integrate GitHub with Twilio

Appy Pie Connect allows you to automate multiple workflows between GitHub and Twilio

  • No code
  • No Credit Card
  • Lightning Fast Setup
Heart

20 Million work hours saved

Award Winning App Integration Platform

About GitHub

GitHub is the best place to share code with co-workers, and clients . Over ten million people use GitHub to build amazing things together.

About Twilio

Twilio is the communciton platform that millions of developers trust to build seamless communications experiences with phone calls, text messages, video calls, and more.

Want to explore GitHub + Twilio quick connects for faster integration? Here’s our list of the best GitHub + Twilio quick connects.

Explore quick connects

Looking for the Twilio Alternatives? Here is the list of top Twilio Alternatives

  • Zoho CRM Integration Zoho CRM
  • CallFire Integration CallFire
  • CallHub Integration CallHub
  • Infobip Integration Infobip
  • MessageBird Integration MessageBird
  • Plivo Integration Plivo
  • TextMagic Integration TextMagic
  • Zipwhip Integration Zipwhip
Connect GitHub + Twilio in easier way

It's easy to connect GitHub + Twilio without coding knowledge. Start creating your own business flow.

  • Triggers
  • New Commit

    Triggered when a new commit is created. Select your organization, repo and branch.

  • New Notification

    Triggered when a new notification is created.

  • New Call

    Triggers once a call is completed on your Twilio number.

  • New Recording

    Triggers once a new recording becomes available on your Twilio account.

  • New SMS

    Triggers the moment an SMS is sent to your Twilio Number.

  • Actions
  • Create Issue

    Create a new issue.

  • Create Pull Request

    Create a new pull request and merge it (optional).

  • Update Issue

    Update an existing issue.

  • Call Phone

    Call a number or numbers and say your predefined message.

  • Send SMS

    Send a SMS to a number or numbers.

How GitHub & Twilio Integrations Work

  1. Step 1: Choose GitHub as a trigger app and authenticate it on Appy Pie Connect.

    (30 seconds)

  2. Step 2: Select "Trigger" from the Triggers List.

    (10 seconds)

  3. Step 3: Pick Twilio as an action app and authenticate.

    (30 seconds)

  4. Step 4: Select a resulting action from the Action List.

    (10 seconds)

  5. Step 5: Select the data you want to send from GitHub to Twilio.

    (2 minutes)

  6. Your Connect is ready! It's time to start enjoying the benefits of workflow automation.

Integration of GitHub and Twilio

GitHub

GitHub is a web-based hosting service for software development projects that use the Git revision contrp system. It is primarily used for computer code.

Twilio

Twilio is a cloud communications company based in San Francisco, California, that allows software developers to program phone calls and text messages within their applications using its web service API. Twilio started in 2008. Since then, it has raised more than $100 million in funding and acquired two other companies.

Integration of GitHub and Twilio

Integration of GitHub and Twilio can be implemented using git hooks. With git hooks you can automatically trigger common tasks when certain events occur.

The first step is to download the sample repository and enter your own information into the files. This needs to be done on your local machine, not on the server. The repository can be found on Github at https://github.com/F5Networks/github_twilio_sample. All of the code changes need to be made to the .git directory in this repository.

In order to configure git hooks, go to the project’s root directory and run the fplowing command:

git init --bare Initialized empty Git repository in /home/deployer/repositories/github_twilio_sample/.git/ 1 2 3 git init -- bare Initialized empty Git repository in / home / deployer / repositories / github_twilio_sample / . git /

This will create a directory called .git which will store all of the git data for this project. We also need to make a new directory for our hooks. This directory will be called .git/hooks/post-commit:

mkdir .git/hooks/post-commit Created dir .git/hooks/post-commit 1 2 3 mkdir . git / hooks / post - commit Created dir . git / hooks / post - commit

You will now need to edit the file called post-commit:

vim .git/hooks/post-commit 1 2 3 vim . git / hooks / post - commit

The first thing that we need to do is tell git to ignore the post-commit file. The reason why we are doing this is so that when you go to push your changes to the remote repository, it doesn’t try to execute the hook at that time. This is necessary because when we pushed our code, our hook would try to send an email out and we don’t want that until after we have pushed our code and everything is set up properly. To ignore the file, add the fplowing line to the top of your post-commit file:

#!/bin/bash # Ignore this file [ -f "$1" ] || exit 0 source "$1" 1 2 3 4 5 6 #!/bin/bash # Ignore this file [ - f "$1" ] || exit 0 source "$1"

The next thing that we need to do is write the actual hook into this file. The hook will look for any commits made on the master branch and check if there was any errors when push was attempted. If there were errors, then it will send an email out to the person who made the commit containing the error message and a link to the last commit where everything worked properly. Here is an example of how this looks:

#!/bin/bash # Ignore this file [ -f "$1" ] || exit 0 source "$1" # Check for errors if [[ $1 =~ ^(master|HEAD)$ ]] && [[ $(git status --porcelain. =~ "nothing to commit, working tree clean" ]]; then echo "There were errors pushing to origin." >&2 echo "Please see the fplowing commit(s. where everything worked correctly:" >&2 sed -n -e 's/,([^[:space:]]*)[{}]([^[:space:]]*)$/1 2/p' < $1 > tmpfile && cat tmpfile fi 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #!/bin/bash # Ignore this file [ - f "$1" ] || exit 0 source "$1" # Check for errors if [ [ $ 1 = ~ ^ ( master | HEAD . $ ] ] && [ [ $ ( git status -- porcelain . = ~ "nothing to commit, working tree clean" ] ] ; then echo "There were errors pushing to origin." > & 2 echo "Please see the fplowing commit(s. where everything worked correctly:" > & 2 sed - n - e 's/,([^[:space:]]*)[{}]([^[:space:]]*)$/1 2/p' < $ 1 > tmpfile && cat tmpfile fi

This should be pretty self explanatory but let’s go over it quickly. When our script detects that we are on the master branch and that there are no errors before our last commit, it will print out a message with a list of all of our commits that worked properly with a link attached to each message so that we can check what changed between those commits and this one. We also tell git not to check for any other branches since they won’t have any commits on them anyway. Let’s make sure that everything works correctly by running our command from earlier again but this time we will put the name of our repository instead of master:

./githook-test github_twilio_sample 1 ./githook-test github_twilio_sample

Your output should look something like this:

Checking for errors... Nothing found! Commit SHA. fb8a2f0a6c17697799b6de8d7eebbb973baf7c44 Author. F5 Networks <[email protected]> Date. Fri Nov 3 20:30:23 2014 -0800 Update README Checksums 1 Checking for errors . . . Nothing found ! Commit SHA . fb8a2f0a6c17697799b6de8d7eebbb973baf7c44 Author . F5 Networks < support @ f5netsw > Date . Fri Nov 3 20 . 30 . 23 2014 - 0800 Update README Checksums

As you can see, there are no errors so there were no emails sent out by our script. After we push our code to production, we should see an email with our commits listed as shown below:

The process to integrate GitHub and Twilio may seem complicated and intimidating. This is why Appy Pie Connect has come up with a simple, affordable, and quick spution to help you automate your workflows. Click on the button below to begin.

Page reviewed by: Abhinav Girdhar  | Last Updated on November 09,2022 06:11 pm