ringcentral/glip-botman 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ringcentral/glip-botman

Composer 安装命令:

composer require ringcentral/glip-botman

包简介

Independent adaptor for Glip to support Botman

README 文档

README

Build Status Code Climate License: MIT Chat Coverage Status Codacy Badge Scrutinizer Code Quality

Glip - Botman

Glip Adaptor for Botman.

APP screenshots

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 :

Requirement

  • 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"

Installation & Setup

Via Github Repo

$ git clone https://github.com/anilkumarbp/glip-botman.git
$ cd glip-botman
$ curl -sS https://getcomposer.org/installer | php
$ composer install

Via Composer

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');

Configure your Bot

Provide Bot User details in .env file:

$ 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                                

Define an Application in RingCentral

In order to communicate with the RingCentral API, you will need to have RingCentral API Keys for the appropriate environment, either Sandbox or Production.

  1. 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

Usage

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.

Start the PHP built-in Web Server locally

$ cd glip-botman
$ php -S localhost:8080

Start ngrok ( Optional )

For demo purposes we are using ngrok.

Open another terminal and:

$ ngrok http 8080

Setup Webhook URL for the Bot

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.

Start the Bot

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

On-Boarding Bot into Glip

  1. Assign a Name and Unique Email Address to the Bot
    https://service.devtest.ringcentral.com Bot user screenshots

Note: The above user refers to the same user whose credentials was used in the .env file to configure the bot.

  1. Invite the bot into a group using the email ID
    https://glip.devtest.ringcentral.com/ Glip group screenshots

Note: Create a group on Glip and invite the Bot using Add Member button on the top extreme right.

  1. Start chatting with the Bot Glip group screenshots

Extending the Botman-Glip Adapter

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

Dependencies

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.

Links

Project Repo

RingCentral SDK for PHP

RingCentral API Docs

RingCentral API Explorer

Contributions

Any reports of problems, comments or suggestions are most welcome.

Please report these on glip-botman's Issue Tracker in Github.

License

RingCentral SDK is available under an MIT-style license. See LICENSE.txt for details.

RingCentral SDK © 2017 by RingCentral

FAQ

ringcentral/glip-botman 适用场景与选型建议

ringcentral/glip-botman 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 8, 最近一次更新时间为 2017 年 10 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「api」 「connect」 「sdk」 「platform」 「ringcentral」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 ringcentral/glip-botman 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ringcentral/glip-botman 我们能提供哪些服务?
定制开发 / 二次开发

基于 ringcentral/glip-botman 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 7
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-18