As a software program engineer and open source fanatic from Tanzania, I do know firsthand the challenges of accessing the web. Lacking vital notifications when offline is a typical drawback in such eventualities. To sort out this drawback, I created a Github Motion that sends SMS notifications to a telephone quantity utilizing AfricasTalking Programmable SMS API. This motion ensures that I obtain notifications even when I’m not on-line. On this weblog put up, I’ll introduce you to this motion and present you the way to use it.
This concept got here when a venture required a scorching repair however I wasn’t on-line in time and thus might take motion in time. Then I although cannot I arrange a workflow that might ship SMS notifications to a telephone quantity each time a pull request/difficulty is created. I used to be capable of obtain this through the use of the AfricasTalking Programmable SMS API. I then determined to create a Github Motion that might make it simpler for different builders to arrange SMS notifications of their workflows.
In 2020 I participated the GitHub Actions Hackathon. I made the primary model of the motion within the hackathon. I used to be capable of enhance the motion and make it extra sturdy by including assist for sending SMS notifications to a number of telephone numbers. I’m joyful to announce model 2 of motion is now accessible on Github.
The next are the steps to make use of the SMS notification Github Motion:
Step 1: Create a .github/workflows/sms.yml
file in your repository.
Step 2: Add the next content material to the sms.yml
file:
identify: SMS Notifications
on:
pull_request:
jobs:
smsNotification:
runs-on: ubuntu-latest
steps:
- makes use of: actions/checkout@v3
- makes use of: alphaolomi/actions-africastalking@major
with:
fromPhoneNumber: 'INFO' # or secrets and techniques.fromPhoneNumber
toPhoneNumber: ${{ secrets and techniques.toPhoneNumber }}
message: 'Hiya World'
env:
AT_API_KEY: ${{ secrets and techniques.AT_API_KEY }}
AT_USERNAME: ${{ secrets and techniques.AT_USERNAME }}`
You possibly can customise the message to mirror the occasion that triggered the workflow. For instance, you’ll be able to ship a message that claims A brand new pull request has been created
when a pull request is created. It’s also possible to ship a message that claims A pull request has been merged
when a pull request is merged. It’s also possible to ship a message that claims A pull request has been closed
when a pull request is closed.
Or extra superior use instances, instance
message: PR #${{ github.occasion.pull_request.quantity }} has been ${{ github.occasion.motion }}' on ${{ github.repository }} by ${{ github.actor }}
Step 3: Add the next secrets and techniques to your repository:
-
AT_API_KEY
– Your Africastalking API Key -
AT_USERNAME
– Your Africastalking Username
To get an API key, comply with the directions on the AfricasTalking website.
The SMS notification Github Motion will ship a notification message to the telephone quantity specified within the toPhoneNumber
area with the message specified within the message
area. It’s also possible to specify a fromPhoneNumber
area to set the telephone quantity from which the message will likely be despatched. If you do not need to show your telephone quantity, you should utilize the secrets and techniques.fromPhoneNumber
area to specify a secret.
In conclusion, with this Github Actions, you’ll be able to wire up many use instances and this is only one of them. This may be significantly helpful for builders and group leaders in areas the place web entry is difficult. By utilizing AfricasTalking SMS API, you’ll be able to simply arrange SMS notifications in your workflow. The SMS notification Github Motion is accessible on Github, and I encourage you to provide it a strive.
Ship an SMS from GitHub Actions utilizing Africastalking Programmable SMS
A GitHub Motion to ship a textual content message to cellular variety of selection utilizing Africastalking Programmable SMS
Utilization
- Create a
.github/workflows/sms.yml
file in your repository. - Add the next content material to the
sms.yml
file:
identify: SMS Notification
on:
pull_request:
jobs:
smsNotification:
runs-on: ubuntu-latest
steps:
- makes use of: actions/checkout@v3
- makes use of: alphaolomi/actions-africastalking@major
with:
fromPhoneNumber: 'INFO' # or secrets and techniques.fromPhoneNumber
toPhoneNumber: ${{ secrets and techniques.toPhoneNumber }}
message: 'Hiya World'
env:
AT_API_KEY: ${{ secrets and techniques.AT_API_KEY }}
AT_USERNAME: ${{ secrets and techniques.AT_USERNAME }}
- Add the next secrets and techniques to your repository:
-
AT_API_KEY
– Your Africastalking API Key -
AT_USERNAME
– Your Africastalking Username
Inputs
-
AT_API_KEY
Required. You will get this from the Africastalking’s Dashboard. -
AT_USERNAME
Required. Use ‘sandbox’ as the worth for growth within the take a look at atmosphere -
fromPhoneNumber
Required. The identify or quantity the message will…