Skip to content

nexmo-community/firebase-functions-sms-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vonage SMS with Firebase Functions

This example sends and receives Vonage SMS with Cloud Functions for Firebase. 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 Vonage

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

Project Prerequisites

Install Example

  1. Clone this repository and switch to the cloned directory

Setup Firebase

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

Setup Vonage

  1. Setup the Vonage CLI
  2. Create a new application vonage apps:create
  3. Purchase a new phone number using. The example below will buy an available US phone number. For more information on SMS Countries and Features - visit the API Support Help Center vonage numbers:search US vonage numbers:buy [NUMBER] --country_code US
  4. Link the number (for instance 15555555555) to the application vonage apps:link [APPID] --number=[NUMBER]
  5. Add the function to the inbound SMS in the Vonage dashboard https://[LOCATION]-[YOU R-PROJECT-ID].cloudfunctions.net/inboundSMS
  6. Add your Vonage keys to the Firebase environment variables firebase functions:config:set vonage.api_key="Your Key" vonage.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

Send and Receive SMS Messages with Cloud Functions for Firebase

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%