Skip to main content

Overview

This guide shows how to write an MMS autoresponder using Plivo’s APIs and Node.js. An autoresponder can provide instant, automated replies with media based on keywords in incoming messages.

How it works

When Plivo receives an MMS on your number, it sends an HTTP request (webhook) to your application’s “Message URL.” Your server can then use the REST API to trigger a new outbound MMS in response. Your server should also send a 200 OK response to Plivo to acknowledge the incoming webhook.

Prerequisites

  • A Plivo account — sign up for free if you don’t have one.
  • An MMS-enabled Plivo phone number. You can rent a number from the Plivo console.
  • Node.js and the Plivo Node.js SDK installed.

Create the autoresponder application

Create a file called mms_autoresponder.js and paste this code into it. This server listens for incoming messages, checks for keywords like “hi” or “bye,” and sends back an MMS with text and a GIF.

Create and configure a Plivo application

  1. Create an Application: Go to Messaging > Applications and click Add New Application.
  2. Configure the URL: Name the application (e.g., MMS Autoresponder). In the Message URL field, enter your server URL (e.g., https://<yourdomain>.com/autoresponder/) and set the method to POST. Click Create Application.
  3. Assign a Number: Go to the Numbers page, select your number, and link it to the MMS Autoresponder application.

Test it out

Send an MMS with the text “hi” or “bye” to your Plivo number to see the different GIF responses.