This is a simple Botman Adaptor for Glip which is ready to use and fairly simple to install. Before we install, lets look at the requirements below :
- PHP 5.5+
- CURL extension
- MCrypt extension
Note: for PHP v 5.6 you would need to comment the below line in the php.ini
file.
"always_populate_raw_post_data = -1"
$ git clone https://github.com/anilkumarbp/glip-botman.git
$ cd glip-botman
$ curl -sS https://getcomposer.org/installer | php
$ composer install
Require this package with composer using the following command:
$ composer require anilkumarbp/glip-botman
Require Composer's autoloader in your PHP script ( index.php ) assuming it is in the same directory where you installed Composer :
require('vendor/autoload.php');
$ vi .env
Edit the .env file and copy the below and edit app details and user details.
GLIP_SERVER=https://platform.devtest.ringcentral.com // Server Url ( Production: https://platform.ringcentral.com || Sandbox: https://platform.devtest.ringcentral.com )
GLIP_APPKEY=appKey
GLIP_APPSECRET=appSecret
GLIP_USERNAME=Username
GLIP_PASSWORD=Password
GLIP_EXTENSION=Extension
In order to communicate with the RingCentral API, you will need to have RingCentral API Keys for the appropriate environment, either Sandbox or Production.
- Login to the Developer Portal https://developer.ringcentral.com/login.html#/ if you haven't already. 2. Click on 'Create App' to define a new application
- Application Name: Your choice, but something easy to identify and associate with purpose is good
- Description: Your suitable description for the application.
- Application Type: Private
- Platform Type: Server-only (No UI)
- Permissions Needed:
- Glip
- Webhook Subscriptions
Note : This bot uses Webhook Based Subscriptions to Listen to conversations posted on Glip
For more information on Webhooks, refer to our QuickStart Guide on Webhooks
Note: The demo assumes that you are not using a Live server instead the PHP's Built-In Web server and the tunneling service from ngrok.
$ cd glip-botman
$ php -S localhost:8080
For demo purposes we are using ngrok.
Open another terminal and:
$ ngrok http 8080
Just point the webhook subscription URL to: ( you must start ngrok if using it ) lets say the above step gives you an endpoint for the server as below:
https://f0aad057.ngrok.io/index.php
Add this to the .env parameter GLIP_WEBHOOK_URL
created above.
In the terminal, just run this command:
$ cd glip-botman
$ php index.php
If its successful, you will get a message as below :
Wohooo, your Bot is Registered. Please follow the instructions on on-boarding the bot into Glip
- Assign a Name and Unique Email Address to the Bot
https://service.devtest.ringcentral.com
Note: The above user refers to the same user whose credentials was used in the .env
file to configure the bot.
- Invite the bot into a group using the email ID
https://glip.devtest.ringcentral.com/
Note: Create a group on Glip
and invite the Bot using Add Member
button on the top extreme right.
You can set the Bot
to listen to any specific commands/instructions . You can include the commands in the php file whihc is used to setup the Webhook. In our case, it is webhook.php
// Give the bot something to listen for.
$botman->hears('hello', function (BotMan $bot) {
$bot->reply('Hello yourself.');
});
$botman->hears('how are you doing', function (BotMan $bot) {
$bot->reply('I am fine how are you doing today ?');
});
For more details, please take a look at Botman's official guide on Hearing Messages
Currently used RingCentral-PHP SDK version for this demo:
"ringcentral/ringcentral-php": "^2.0.0"
"mpociot/botman":"latest"
- Make sure to change the SDK version in the composer.json before you chose to use a different SDK Version.
Project Repo
RingCentral SDK for PHP
RingCentral API Docs
RingCentral API Explorer
Any reports of problems, comments or suggestions are most welcome.
Please report these on glip-botman's Issue Tracker in Github.
RingCentral SDK is available under an MIT-style license. See LICENSE.txt for details.
RingCentral SDK © 2017 by RingCentral
- What if I do not have a RingCentral account? Don't have an account, no worries: Become a RingCentral Customer
- I/My company is an Independent Software Vendor (ISV) who would like to integrate with RingCentral, how do I do that? You can apply to Join the RingCentral Partner Program