Skip to content

Nexmo/php-phone-menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic Phone Menu using PHP and the Nexmo Voice API

This app uses the Nexmo Voice API to demonstrate an interactive order status phone menu.

  • Callers can search for orders by order ID.
  • If the caller's number is found, they can get the status of their latest order.

Prerequisites

You will need:

  • At least one Nexmo Virtual Number (Phone Number)
  • composer installed
  • The Nexmo CLI installed
  • A public web server to host this web app, or ngrok on your local development system.

Installation

git clone https://github.com/nexmo/php-phone-menu.git
cd php-phone-menu
composer install

Configuration

Copy config.php.dist to config.php, and add public URL Nexmo can use to access the application. If you're using ngrok you'll need to know what subdomain will be used to expose your application.

Setup (Using Nexmo CLI)

Create the nexmo application, using the Nexmo CLI and take note of the application universally unique identifier (UUID):

nexmo app:create demo-app --keyfile private.key http://example.com http://example.com

Buy numbers for calls that you would like to track. The following example buys the first available number in a given country by country code.

nexmo number:buy --country_code [YOUR_COUNTRY_CODE]

Link the virtual numbers to the app id with the Nexmo CLI:

nexmo link:app [NUMBER] [app-id]

Update the app to set the webhook urls to be your server (or ngrok subdomain) instead of the example.com placeholders used at creation.

nexmo app:update ['app-id'] demo-app [your url]/answer [your url]/event

Running the App

Using the PHP development server:

php -S 0:8080 ./public/index.php

To expose the application to the public internet:

ngrok http 8080

Or you can configure a webserver to serve the app using /public as the webroot.

Using the App

Call the virtual number to check order status over the phone. You can enter any order ID as the system chooses a random status.

Releases

No releases published

Packages

No packages published

Languages