Skip to content

medchalouli/Twilio-sms

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample Function: Python "Twilio SMS"

Introduction

This repository contains a sample Twilio SMS function written in Python. You are able to send an sms using Twilio verified phone numbers. You can deploy it on DigitalOcean's App Platform as a Serverless Function component. Documentation is available at https://docs.digitalocean.com/products/functions.

Requirements

Deploying the Function

# clone this repo
git clone git@github.com:digitalocean/sample-functions-python-twilio-sms.git
# deploy the project, using a remote build so that compiled executable matched runtime environment
> doctl serverless deploy sample-functions-python-twilio-sms --remote-build
Deploying 'sample-functions-python-twilio-sms'
  to namespace 'fn-...'
  on host 'https://faas-...'
Submitted action 'sms' for remote building and deployment in runtime python:default (id: ...)

Deployed functions ('doctl sls fn get <funcName> --url' for URL):
  - sample/sms

Using the Function

doctl serverless functions invoke sample/sms -p from:1234567890 number:0123456789 message:Good Morning from Sammy.
{
  "body": "message sent"
}

To send an email using curl:

curl -X PUT -H 'Content-Type: application/json' {your-DO-app-url} -d '{"from":"1234567890", "number":"0123456789", "message":"Good Morning from Sammy."}' 

Learn More

You can learn more about Functions and App Platform integration in the official App Platform Documentation.

About

Sending sms via Twilio

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.1%
  • Shell 0.9%