SMS API | Integration with Github
GitHub is the most popular source code management and Distributed Version Control System (DVCS). For many users, monitoring changes in their repositories is a key requirement.
This guide will help you connect GitHub Actions to your phone. If there is any change in the repository, you will immediately receive an SMS message through the tyntec SMS API.
You will need
- An active tyntec SMS API key.
- A Github account.
- Your favorite text editor with Syntax Highlighting.
- Node.js installed.
Step One: Prepare your Github repository
1. Create a new Github repository: /.github/workflows.
2. Create a new file sms_notifications.yml. and README.md.
3. Insert code into the build.yml file:
on:
push:
branches:
- main
- 'releases/*'
jobs:
sms_notification:
runs-on: ubuntu-latest
steps:
- uses: tyntec/github-action-sms@v1 # PATH TO TYNTEC GITHUB ACTION
with:
fromPhoneNumber: ${{ secrets.FROM_PHONE_NUMBER }}
toPhoneNumber: ${{ secrets.TO_PHONE_NUMBER }}
message: There are new changes in your GitHub repository.
env:
TYNTEC_API_KEY: ${{ secrets.TYNTEC_API_KEY }}
Step Two: Create a new Github action
1. Go to the Settings of your repository and click Secrets – Action.
2. Click New repository secret.
3. Insert one by one: FROM_PHONE_NUMBER, TO_PHONE_NUMBER, TYNTEC_API_KEY and their value.
4. The Actions section should look like this:
Do you have the same result as in the screenshot? Perfect. Your secrets are all set.
Step Three: Test your app
1. Open your favorite text editor.
2. Clone your repository.
"git clone <repoUrl>"
3. Make some changes in the README.md file.
4. Push your changes to GitHub.
"git add ."
"git commit"
"git push origin"
5. Open GitHub.
6. Open Actions. You should see a new workflow up and running.
You can also check details of workflow:
7. Check your mobile phone for message:
That’s it. You successfully implemented SMS alerts for repository changes.