https://github.com/rishabkumar7/twilio-azure-function-sms
An Azure Function that can send an SMS using Twilio using HTTP Trigger.
https://github.com/rishabkumar7/twilio-azure-function-sms
Last synced: over 1 year ago
JSON representation
An Azure Function that can send an SMS using Twilio using HTTP Trigger.
- Host: GitHub
- URL: https://github.com/rishabkumar7/twilio-azure-function-sms
- Owner: rishabkumar7
- Created: 2024-04-12T15:47:42.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-12T15:57:37.000Z (about 2 years ago)
- Last Synced: 2025-01-11T18:47:37.376Z (over 1 year ago)
- Language: Shell
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Twilio Azure Function
This project is an Azure Function that sends SMS messages using the Twilio API.
## Prerequisites
- Node.js and npm
- Azure Functions Core Tools
- An Azure account
- A Twilio account
## Setup
1. Clone this repository.
2. Run `npm install` to install the dependencies.
3. Set up your Twilio account and get your Account SID, Auth Token, and a Twilio phone number.
4. Update the `local.settings.json` file with your Twilio Account SID, Auth Token, and phone number.
## Running the Function Locally
1. Start the function with `npm start`.
2. Send a POST request to `http://localhost:7071/api/SMSTrigger` with a JSON body containing `number` and `message` fields. For example:
```json
{
"number": "",
"message": "Ahoy, world!"
}
```
curl request example:
``` bash
curl -m 70 -X GET http://localhost:7071/api/SMSTrigger/ \
-H "Content-Type: application/json" \
-d '{
"message": "Ahoy from Azure Functions.",
"number": ""
}'
```
## Deploying to Azure
Run the `twilio-azure-function-create.sh` script to create a new Azure Function App and associated resources.
Deploy the function to Azure with `func azure functionapp publish `, replacing `` with the name of your Function App.
## Author
[Rishab Kumar](https://rishabkumar.com)
- [Twitter](https://twitter.com/rishabincloud)
- [GitHub](https://github.com/rishabkumar7)