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.
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.
git clone https://github.com/nexmo/php-phone-menu.git
cd php-phone-menu
composer install
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.
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
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.
Call the virtual number to check order status over the phone. You can enter any order ID as the system chooses a random status.