Send an SMS from GitHub Actions.
- A Twilio Account. Sign up for free
- A Twilio API Key and Secret
-
Set up your credentials as secrets in your repository settings using
TWILIO_ACCOUNT_SID
,TWILIO_API_KEY
,TWILIO_API_SECRET
-
Add the following to your workflow
name: Twilio Sned
on:
workflow_dispatch: # allows you to manually trigger the workflow
schedule: # runs on a cron, nightly
- cron: 0 0 * * *
env:
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }}
TWILIO_API_KEY: ${{ secrets.TWILIO_API_KEY }}
TWILIO_API_SECRET: ${{ secrets.TWILIO_API_SECRET }}
permissions:
contents: read
jobs:
send:
runs-on: ubuntu-latest
steps:
- name: 'Sending SMS Notification'
uses: twilio-labs/actions-sms@v1
with:
fromPhoneNumber: '+12345678900' # alternatively, use a Repository Secret
toPhoneNumber: '+12345678900' # alternatively, use a Repository Secret
message: 'Hello from Twilio'
Required Phone number in your Twilio account to send the SMS from
Required Phone number to send the SMS to
Required The message you want to send
A Twilio Account SID. Can alternatively be stored in environment
A Twilio API Key. Can alternatively be stored in environment
A Twilio API Secret. Can alternatively be stored in environment
The SID of the message resource associated with the SMS sent.
This GitHub Action uses a couple of Node.js modules to work.
License and other copyright information for each module are included in the release branch of each action version under node_modules/{module}
.
More information for each package can be found at https://www.npmjs.com/package/{package}