This repo will help you get started with connecting Nexmo to an IBM Voice Agent with Watson service orchestration engine. This will allow you to create complex flows to interact with your customers.
This sample project uses Node-RED to create the connection between Nexmo and IBM Voice Agent with Watson.
- Signup for IBM Cloud account (if you don't already have one)
- Create Node-RED Starter app in IBM Cloud (requires upgrade to Premium)
- This process can take a few minutes.
- Once complete, click
View App URL
- Follow directions to setup Node-RED
- Copy the
https://<app name>.mybluemix.net
part of the application for use in the next step.
You will need a Nexmo number and setup the voice application for this app. There are two ways to create an application with Nexmo - using the dashboard or the Nexmo CLI. This section will cover both methods.
- Sign in or create a Nexmo account
- Buy a new virtual number
- Create a voice application
- Add the event url -
https://<app name>.mybluemix.net/eventURL
- Add the answer url -
https://<app name>.mybluemix.net/answerURL
- Click
Create Application
- Click
Numbers
and link the recently created virtual number. - Copy the virtual number for use in the next step.
- Install the CLI by following these instructions.
- Buy a virtual number
nexmo number:buy --country_code US
- Create the Voice Application
nexmo app:create "VoiceApplication" https://<app name>.mybluemix.net/eventURL https://<app name>.mybluemix.net/eventURL --keyfile private.key
- Link the virtual number to the application
nexmo link:app 15555555555 aaaaaaaa-bbbb-cccc-dddd-0123456789ab
Next you will need to create the Voice Agent in IBM Cloud. Copy the virtual number you created in in Nexmo for this step.
- Create an IBM Voice Agent with Watson
- Click
Manage
and thenCreate a voice agent
- Give your agent a name, and paste the Nexmo number in the
Phone number
field. - Under Watson Assistant:
- Copy the workspace ID and store it for the Node-RED setup.
- Change the
Service type
toService orchestration engine
- Add the url
https://<app name>.mybluemix.net/soe
- Enter your username and password from Node-RED
- Click
Create voice agent
- Navigate to
Getting Started
and copy your SIP endpoint and add your phone number to it like so:sip:[email protected]
There is a sample flow you can import and begin using right away.
- Open
NodeRED-Nexmo-SOE.json
and copy the entire contents. - Open your Node-RED application.
- In the top right menu find
Import > Clipboard
- Paste the json into the window, select
New Flow
and clickImport
.
During the Voice Agent setup, it created a Watson Assistant service. Locate this in your IBM Cloud account.
- Copy the
API Key
and theURL
- In Node-RED, locate the
Watson Assistant
node, and paste in theAPI Key
, paste theURL
toService Endpoint
, and theWorkspace ID
you received during the last step. - Click
Done
- Locate the
Connect
node, and open it. - Paste your SIP endpoint into the
URI
field. - Add your virtual number to the
From
field.
Once all configuration is complete, click the Deploy
button in node red to push the flow live.
Dial your virtual phone number. You will hear Please wait while we connect you.
followed by the Watson Voice Assistant telling you about Voice Agent.
To take this further, you will want to build your own Voice Assistant skill set with intents and dialog. You can listen for these with a Node-RED switch and build flows and sub-flows to manage each specific intent.