Skip to content

kellyjandrews/firebase-functions-sms-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nexmo SMS with Firebase Functions

This example sends and receives Nexmo SMS with Firebase Functions. Inbound SMS messages use a webhook on Firebase to add the message to the Firebase Realtime Database. Upon creation, a triggered function will echo back the original text to the phone number.

Welcome to Nexmo

If you're new to Nexmo, you can sign up for a Nexmo account and get some free credit to get you started.

Project Prerequsites

Install Example

  1. Clone this repository and switch to the cloned directory

Setup Firebase

  1. Setup Firebase Tools
  2. Run firebase init functions
    1. Create a new project
    2. Select JavaScript
    3. Add ESLint
    4. Do not overwrite any files
    5. Install all dependencies
  3. Open Firebase console https://console.firebase.google.com/project/YOUR-PROJECT-ID/ overview
    1. Go to ⚙️ -> Project Settings
    2. Update Google Cloud Platform (GCP) resource location to something near your location
    3. Go to ⚙️ -> Usage and Billing -> Details & Settings
    4. Update the plan to Blaze - Pay As You Go
  4. Run firebase deploy --only functions
    1. Copy the function route - https://[LOCATION]-[YOUR-PROJECT-ID].cloudfunctions.net/inboundSMS

Setup Nexmo

  1. Setup the Nexmo CLI
  2. Purchase a new phone number using nexmo number:buy --country_code US
    1. This will buy an available US phone number.
    2. For more information on SMS Countries and Features - visit https://help.nexmo.com/hc/en-us/articles/115011451687-SMS-Numbers-Features-Overview
  3. Link the function route to the number nexmo link:sms 15555555555 https://[LOCATION]-[YOUR-PROJECT-ID].cloudfunctions.net/inboundSMS
  4. Add your Nexmo keys to the Firebase environment variables firebase functions:config:set nexmo.api_key="Your Key" nexmo.api_secret="Your Secret"

Try It Out

Text anything you want to the purchased number, and it will echo back what you sent in.

To: 15555555555
Hello World!

From: 15555555555
You sent the following text: Hello World!

Getting Help

We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:

Further Reading

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published