Skip to content

Latest commit

 

History

History
94 lines (73 loc) · 2.8 KB

driver-nexmo.md

File metadata and controls

94 lines (73 loc) · 2.8 KB

Nexmo

Installation & Setup

First you need to pull in the Nexmo Driver.

composer require botman/driver-nexmo

Then load the driver before creating the BotMan instance (only when you don't use BotMan Studio):

DriverManager::loadDriver(\BotMan\Drivers\Nexmo\NexmoDriver::class);

// Create BotMan instance
BotManFactory::create($config);

Or if you use BotMan Studio:

php artisan botman:install-driver nexmo

This driver requires a valid and secure URL in order to set up webhooks and receive events and information from the users. This means your application should be accessible through an HTTPS URL.

{callout-info} ngrok is a great tool to create such a public HTTPS URL for your local application. If you use Laravel Valet, you can create it with "valet share" as well.

To connect BotMan with Nexmo, you first need to create a Nexmo account here and buy a phone number, which is capable of sending SMS.

Go to the Nexmo dashboard at https://dashboard.nexmo.com/settings and copy your API key and API secret into your BotMan configuration. If you use BotMan Studio, you can find the configuration file located under config/botman/nexmo.php.

If you dont use BotMan Studio, add these line to $config array that you pass when you create the object from BotManFactory.

'nexmo' => [
	'key' => 'YOUR-NEXMO-APP-KEY',
	'nexmo_secret' => 'YOUR-NEXMO-APP-SECRET',
]

Register Your Webhook

To let Nexmo send your bot notifications when incoming SMS arrive at your numbers, you have to register the URL where BotMan is running at, with Nexmo.

You can do this by visiting your Nexmo dashboard at https://dashboard.nexmo.com/settings.

There you will find an input field called Callback URL for Inbound Message - place the URL that points to your BotMan logic / controller in this field.

Supported Features

This is a list of features that the driver supports. If a driver does not support a specific action, it is in most cases a limitation from the messaging service - not BotMan.

Feature Supported?
Question-Buttons
Image Attachment
Video Attachment
Audio Attachment
Location Attachment