Send and Receive SMS Messages with Firebase Functions | One Dev Minute
Published on November 25, 2021

Welcome to One Dev Minute! This series is hosted on the Vonage Dev YouTube channel. The goal of this video series is to share knowledge in a bite-sized manner.

This quick walk-through will show you how to create an SMS message log and a response to the sender using Firebase Cloud Functions and the Real Time Database alongside the Vonage SMS API.

Transcript

You can send SMS messages using Cloud Functions for Firebase.

You'll need to create a couple of accounts:

  • a Firebase

  • and a Vonage API one.

Create the project in the Firebase console and choose whether or not you will use Analytics.

Wait for your project to be created.

Select the Firebase billing plan, in this case, it is the pay as you go.

In the Command line, install the Firebase tools.

Login to Firebase and authenticate. Create the project folder and change directory inside of it.

Initialize the Cloud Functions for Firebase.

Install the dependencies we are going to use inside the functions folder.

Create a .env file and add the Vonage environment variables there.

Inside the file index.js, add all the required dependencies and environment variables and initialize Firebase.

In the same file, create the first function which will act as a webhook to capture and log incoming SMS messages from a Vonage phone number.

Let's then create a function for Firebase to send the response SMS and to react to database updates.

Deploy the function, send an SMS message from your phone to the Vonage application phone number.

You'll then receive a response SMS message on your phone and an update to Firebase Real-Time Database.

You can find the full code on GitHub. Thank you for watching and happy coding!

This Tutorial's Code on GitHub.

Find the Written Tutorial Here.

Check Out the Developer Documentation.

Details About Vonage SMS Functionality.

Getting Started with Firebase Functions.

Amanda CavallaroDeveloper Advocate

Ready to start building?

Experience seamless connectivity, real-time messaging, and crystal-clear voice and video calls-all at your fingertips.

Subscribe to Our Developer Newsletter

Subscribe to our monthly newsletter to receive our latest updates on tutorials, releases, and events. No spam.