The Nexmo SMS connector allows your users to interact with your Teneo bot using SMS messages.
The Node.js connector acts as middleware between Nexmo SMS API and a Teneo bot. Visit Nexmo for more information.
The source code for this connector can be found on Github.
Your bot needs to be published and you need to know the engine url.
A Nexmo account with a 'Virtual Phone Number' configured in it. The steps to setup the account, configure billing, and buying a virtual number are described ahead.
Adding funds is required to buy a 'Virtual Phone Number'. €10 will suffice to purchase a number and send many SMS.
A Heroku account is required to deploy the connector online.
Or, to run the connector locally, ngrok is preferred to make the connector available via HTTPS.
To setup communication by SMS between a Teneo bot and Nexmo's SMS API follow these steps:
Below you will find two ways to run the this connector. The first way is by running the connector online with Heroku. This is the easiest way to get the connector running for non-developers since it does not require you to run Node.js or download or modify any code.
The second way is to run the connector locally or to deploy it on a server of your choice. This is preferred if you're familiar with Node.js development and want to have a closer look at the code, or implement modifications and enhancements.
/teneochat
. The final url should look something like: https://yourherokuapp.herokuapp.com/teneochat.That's it! Text your Virtual Phone Number with a mobile phone, and the Teneo bot will send an SMS reply!
The local deployment of this connector allows you to enhance and modify its functionality. To run the connector locally, follow these steps:
git clone https://github.com/artificialsolutions/tie-api-example-nexmo-sms.git && cd tie-api-example-nexmo-sms
npm install
.env
in the root of you project folder. Add the Teneo Engine URL of your bot. Your 'API key' and 'API Secret' are found in Nexmo's Settings
TENEO_ENGINE_URL=<your engine url>
NEXMO_API_KEY=<your API key value>
NEXMO_API_SECRET=<your API Secret 1 value>
NEXMO_NUMBER=<your Virtual Phone Number in E.164 format>
node server.js
Next, we need to make the connector available via https. We'll use ngrok for this.
Start ngrok. The connector runs on port 1337 by default, so we need to start ngrok like this:
ngrok http 1337
Running the command above will display a public https URL. Copy it, we will use it as a Inbound Webhook URL in the final step below.
Inside your Nexmo account's dashboard, navigate to the Virtual Phone Number you purchased in the previous step, and click on Manage
. Paste the public https URL provided by ngrok in the Inbound Webhook URL field and append it will /teneochat
. It should look something like this: https://abcd1234.ngrok.io/teneochat.
That's it! Text your Virtual Phone Number with a mobile phone, and the Teneo bot will send an SMS reply!
Was this page helpful?