npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lp-labs-agent-sdk

v1.0.11

Published

LiveEngage Agent SDK

Downloads

21

Readme

lp-labs-agent-sdk

Easily create LiveEngage messaging Bot. This is an initial version which will be extended soon.

Quick Start

npm install agent-sdk --save

  1. Edit a copy of the example examples/getting_started/echo-bot.js
  2. Create a LiveEngage account with messaging enabled.
  3. Set BRANDID with your LiveEngage account id
  4. Set USERNAME with an agent name associated with your BOT.
  5. Set PASSWORD as the password of the agent associated with your BOT.
  6. run echo-bot.js: node echo-bot.js

Getting Started

Overview

The agent-sdk is built to wrap the agent subset protocol for our UMS service. The sdk is divided to asynchronous events and prmoised based API .

Configuration

let AgentSDK = require('agent-sdk');

/*
    brandid: LiveEngage accountid
    username: LiveEngage agent's login name
    password: LiveEngage agent's password
    timestamp: The time stamp from which LiveEngage events should be fetched
 */
 let as = new AgentSDK(brandid, username, password, timestamp);

Consumer (to agent) Events/Messages (more to come soon)

consumer::ring

Consumer is requesting for a conversation

Sample Data:

{
        "ringId": "1f306a8d-bc48-4d3d-8e74-f778c5588de9_9b9d4251-b748-3475-bcc0-26a18cfd834d",
        "ringState": "646f0078-bb1f-4faf-8353-15be257e4f8f",
        "convId": "684fdcb0-bbf5-44ad-a39d-fcae7919d959",
        "consumerId: "98097e05-f4ab-48be-b0ee-c116edcb6f69",
        "skillId": "736937610"
}

consumer::firstContentEvent

Consumer message sent before the bot accepted the conversation

Sample Data:

{
        "convId": "684fdcb0-bbf5-44ad-a39d-fcae7919d959",
        "sequence":0,
        "consumerId": "98097e05-f4ab-48be-b0ee-c116edcb6f69",
        "serverTimestamp": 1438499478874,
        "type": "ContentEvent",
        "message": "Hi there!!!",
        "contentType": "text/plain"
}

consumer::contentEvent

Consumer message

Sample Data:

{
        "convId": "684fdcb0-bbf5-44ad-a39d-fcae7919d959",
        "sequence":12,
        "consumerId": "98097e05-f4ab-48be-b0ee-c116edcb6f69",
        "serverTimestamp": 1438499478874,
        "type": "ContentEvent",
        "message": "Hi there!!!",
        "contentType": "text/plain"
}

consumer::resolve

Consumer has resolved (closed) the conversation

Sample Data:

{
        "convId": "684fdcb0-bbf5-44ad-a39d-fcae7919d959"
}

Agent APIs Methods (Promise based, more to come soon)

acceptRing

Accept a consumer request for a conversation

Parameters:

    ringId 

Return (Promise) Value:

Empty Promise

getUserProfile

Get the profile of a consumer

Parameters:

userId

Return (Promise) Value:

{
    "firstName":"user1",
    "lastName":"last1",
    "userId":"63d22d42-354c-44b2-b351-3f4e6454c3ef",
    "avatarUrl":"avatarUrl",
    "role":null,
    "backgndImgUri":"backgndImgUri",
    "description":"auto description",
    "privateData":{
        "mobileNum":"0",
        "mail":"",
        "pushNotificationData":{
        "serviceName":"",
        "certName":"",
        "token":""
    }
}

compose

Send a compose notification

Parameters:

convId

Return (Promise) Value:

Empty Promise
    

active

Send an online notification

Parameters:

convId

Return (Promise) Value:

Empty Promise
 

sendText

Send text message

Parameters:

convId
message
       

Return (Promise) Value:

Empty Promise           

resolveConversation

Resolve (close) conversation

Parameters:

convId 

Return (Promise) Value:

Empty Promise    

transferToSkill

Transfer conversation to a different skill. The target skill is associated with another agent (human or bot). Please read #3 in the 'Important issues' section regarding skillId.

Parameters:

convId 
skillId

Return (Promise) Value:

Empty Promise    

Error events

Login

Bot (LiveEngage agent) Login failure

UMS

A UMS API or network error

More Advanced Bot Example

Under the directory examples/luisai_bot, there is more advanced example based on Microsoft's:

  1. botbuilder framework
  2. Luis AI

In the file README.md you will find a useful information for running this example.

Important issues

  1. It's important to register to the sdk errors.
  2. A LoginError is triggered in case that the bot failed to login to LiveEngage. In case that the LoginError is due to "password expired", a new password should be set in LiveEngage and used while initiating an agent-sdk instance.
  3. In order to use transferToSkill method a valid skill id should be used.
    The list of skill ids can be obtained by a csv export inside the LiveEngage console (users->skills)

Support

[email protected]