定制 live-person-inc/live-engage-laravel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

live-person-inc/live-engage-laravel

Composer 安装命令:

composer require live-person-inc/live-engage-laravel

包简介

LiveEngage package for laravel

README 文档

README

Build Status Code Intelligence Status Scrutinizer Code Quality Code Coverage

Latest Stable Version Latest Unstable Version Packagist

Laravel package to easily tap the LiveEngage developer APIs for such content as Engagement History, Engagement Attributes, and more...

Use at your own risk. This package carries no SLA or support and is still currently under development.

Installation

Install via composer

composer require live-person-inc/live-engage-laravel

Register Service Provider

Note! This and next step are optional if you use laravel>=5.5 with package auto discovery feature.

Add service provider to config/app.php in providers section

LivePersonInc\LiveEngageLaravel\ServiceProvider::class,

Register Facade

Register package facade in config/app.php in aliases section

'LiveEngage' => LivePersonInc\LiveEngageLaravel\Facades\LiveEngageLaravel::class,

Usage

Create/Obtain an API key from LiveEngage with appropriate permissions for the APIs you intend to access. The default key is required.

Configure your keys/account in config/services.php

'liveperson' => [
    'default' => [
	    'key' => 'xxxxxxx',
	    'secret' => 'xxxxxxx',
	    'token' => 'xxxxxxx',
	    'token_secret' => 'xxxxxxx',
	    'account' => '123456',
    ]
],

If you want to have multiple API keys, you can add more arrays for them. The keys for each array are arbitrary, but you will need to specify them later to access specific key sets.

'liveperson' => [
    'default' => [
	    'key' => 'xxxxxxx',
	    'secret' => 'xxxxxxx',
	    'token' => 'xxxxxxx',
	    'token_secret' => 'xxxxxxx',
	    'account' => '123456',
    ],
    'history' => [
	    'key' => 'xxxxxxx',
	    'secret' => 'xxxxxxx',
	    'token' => 'xxxxxxx',
	    'token_secret' => 'xxxxxxx',
	    'account' => '123456',
    ],
    'attributes' => [
	    'key' => 'xxxxxxx',
	    'secret' => 'xxxxxxx',
	    'token' => 'xxxxxxx',
	    'token_secret' => 'xxxxxxx',
	    'account' => '123456',
    ]
],

To make an api call on a specific key set...

$history = LiveEngage::key('history')->engagementHistory(); //conversationHistory() for messaging

To use the default keyset, you need not use the key method at all.

$history = LiveEngage::engagementHistory(); //conversationHistory() for messaging

Example: Capturing engagement history between 2 date/times using global account configured above.

use LiveEngage;
use Carbon\Carbon;
$start = new Carbon('2018-06-01 08:00:00');
$end = new Carbon('2018-06-03 17:00:00');

/**
 * engagementHistory function.
 * 
 * @access public
 * @param Carbon $start (default: null)
 * @param Carbon $end (default: null)
 * @param mixed $skills (default: [])
 */ 
$history = LiveEngage::engagementHistory($start, $end);

Example: Getting engagement history between 2 date/times for specific skill IDs.

use LiveEngage;
use Carbon\Carbon;
$start = new Carbon('2018-06-01 08:00:00');
$end = new Carbon('2018-06-03 17:00:00');
$skills = [432,676];

$history = LiveEngage::engagementHistory($start, $end, $skills);

engagementHistory() and conversationHistory() returns a Laravel collection of Engagement objects.

Example: Pulling the next "page" of data in to the collection.

$history->next(); // one page

Or

while ($next = $history->next()) { $history = history->merge($next) } // get all remaining data

Example: Iterate through all messages of the transcript

$engagement = $history->find('3498290084'); // This is a collection, so random(), first(), last() all work as well

foreach ($engagement->transcript as $message) {  // For messaging conversations, use messageRecords instead of transcript
	echo $message . "\n"; // calling the message object as a string returns its text value
}

Transcript is a collection of message objects, so you can access properties of the message as well.

echo $message->time->format('Y-m-d'); //The all time properties are Carbon date objects.
$conversation = LiveEngage::conversationHistory()->first();

foreach ($conversation->transfers as $transfer) {
	echo $transfer->targetSkillName . "\n";
}

Example: Get messaging agents availability by skill

$availableAgents = LiveEngage::getAgentStatus(17); //Skill ID 17

$online = $availableAgents->state('online');
$away = $availableAgents->state('away');

Security

If you discover any security related issues, please email rlester@liveperson.com instead of using the issue tracker.

Credits

This package is bootstrapped with the help of melihovv/laravel-package-generator.

live-person-inc/live-engage-laravel 适用场景与选型建议

live-person-inc/live-engage-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 954 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 06 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 live-person-inc/live-engage-laravel 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 6
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-06-11