Skip to content

Using SMS messages, send queries and get responses from web apis. The application is a web server pluggable to Vonage APIs (formerly Nexmo) inbound message webhook.

License

Notifications You must be signed in to change notification settings

thomariobros/sms-query

Repository files navigation

Go

About

Using SMS messages, send queries and get responses from web apis. The application is a web server pluggable to Vonage APIs (formerly Nexmo) inbound message webhook.

For example sending an SMS text bicloo gare maritime to a bought Vonage phone number triggers the application to call the JCDecaux’s self-service bicycles (bicloo in Nantes, France) API to get available bikes and bike stands and send it back as a SMS.

Vonage APIs configuration

  1. https://dashboard.nexmo.com/your-numbers => buy virtual phone number
  2. https://dashboard.nexmo.com/settings => activate Messages API
  3. https://dashboard.nexmo.com/applications => new application, activate Messages capability and set Inbound URL
  4. link virtual phone number to the new application

Configuration

see example config.yml

local dev

Build

make

cli to test query and print response or send response as SMS

make build-cli
make run-cli from=... query="..." send=false # print
make run-cli from=... query="..." send=true # send SMS
# examples (based on config/config.yml)
SMS_GATEWAY_ALLOWED_PHONE_NUMBERS_1=33601020304 make run-cli from=33601020304 query="help" send=false
SMS_GATEWAY_ALLOWED_PHONE_NUMBERS_1=33601020304 make run-cli from=33601020304 query="search lemonde" send=false
SMS_GATEWAY_ALLOWED_PHONE_NUMBERS_1=33601020304 make run-cli from=33601020304 query="news" send=false

Unit tests

make test

pre-commit

see config file .pre-commit-config.yaml

Install

pre-commit install

Vonage APIs webhooks

External data APIs

JCDecaux’s self-service bicycles (bicloo in Nantes, France)

https://developer.jcdecaux.com/

Transport

http://data.nantes.fr/donnees/detail/info-trafic-temps-reel-de-la-tan/

https://opendata.stif.info/page/home/

https://www.vianavigo.com/accueil

http://doc.navitia.io/#next-departures-and-arrivals

https://canaltp.github.io/navitia-playground/

Weather

https://darksky.net/dev/login

https://darksky.net/forecast/47.2186,-1.5541/us12/en

Deploy

Create

export PHONE_NUMBER=...
export NEXMO_KEY=...
export NEXMO_SECRET=...
export NEXMO_SIGNATURE_SECRET=...
export NEXMO_PHONE_NUMBER=...
export CYCLOCITY_JCDECAUX_API_KEY=...
export CLEVER_TOKEN=...
export CLEVER_SECRET=...
./scripts/clever-cloud-create.sh

Update

export CLEVER_TOKEN=...
export CLEVER_SECRET=...
clever deploy

About

Using SMS messages, send queries and get responses from web apis. The application is a web server pluggable to Vonage APIs (formerly Nexmo) inbound message webhook.

Topics

Resources

License

Stars

Watchers

Forks