Git Product home page Git Product logo

fortunes-by-sms's Introduction

SMS Fortune Sample Demo

A simple serverless app to receive a webhook from Nexmo's SMS Service and respond with a fortune from Ubuntu's excellent collection of fairly silly fortune cookies.

Setup

For the full blog post, look here: https://www.nexmo.com/blog/2018/08/14/serverless-sms-nexmo-ibm-dr/

1. Register for an incoming number

You'll need this to receive SMS messages - set up incoming number before you start.

2. Set up environment variables

Set the variables NEXMO_API_KEY and NEXMO_API_SECRET to the relevant values for your account. Also set NEXMO_NUMBER to the number you bought in step 1 (we'll use it as the from number).

3. Deploy the serverless function

Before deploying a function for the first time, create the package:

ibmcloud fn package update sms-fortune -p apikey $NEXMO_API_KEY -p apisecret $NEXMO_API_SECRET -p nexmonumber $NEXMO_NUMBER

Each language has a deploy.sh file in its folder, run this script (I mean, read the script so you know what's happening: it zips all the dependencies and deploys the result)

4. Set up the webhook for incoming SMS

First we need to ask the serverless function what URL it has:

ibmcloud fn action get --url sms-fortune/incoming-php

Now paste that into the settings screen on your Nexmo dashboard.

OR

Configure from the command line instead:

nexmo link:sms [number] [url]

5. Send yourself a text

Send an SMS (with any content) to the number you set up and laugh at the daft message you get back :)

fortunes-by-sms's People

Contributors

lornajane avatar aaronbassett avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.