An open API service indexing awesome lists of open source software.

https://github.com/codeforequity-at/botium-connector-einsteinbot

Botium Connector for Salesforce Einstein Bots
https://github.com/codeforequity-at/botium-connector-einsteinbot

Last synced: about 1 year ago
JSON representation

Botium Connector for Salesforce Einstein Bots

Awesome Lists containing this project

README

          

# Botium Connector for Einstein Bots

[![NPM](https://nodei.co/npm/botium-connector-einsteinbot.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/botium-connector-einsteinbot/)

[![Codeship Status for codeforequity-at/botium-connector-einsteinbot](https://app.codeship.com/projects/9ba53c50-d343-0138-9788-0add58eace64/status?branch=master)](https://app.codeship.com/projects/408315)
[![npm version](https://badge.fury.io/js/botium-connector-einsteinbot.svg)](https://badge.fury.io/js/botium-connector-einsteinbot)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)]()

This is a [Botium](https://github.com/codeforequity-at/botium-core) connector for testing your Salesforce Einstein chatbot.

__Did you read the [Botium in a Nutshell](https://medium.com/@floriantreml/botium-in-a-nutshell-part-1-overview-f8d0ceaf8fb4) articles? Be warned, without prior knowledge of Botium you won't be able to properly use this library!__

## How it works
Botium connects to your Einstein chatbot using the [Salesforce Live Agent REST API](https://developer.salesforce.com/docs/atlas.en-us.live_agent_rest.meta/live_agent_rest/live_agent_rest_understanding_resources.htm).

It can be used as any other Botium connector with all Botium Stack components:
* [Botium CLI](https://github.com/codeforequity-at/botium-cli/)
* [Botium Bindings](https://github.com/codeforequity-at/botium-bindings/)
* [Botium Box](https://www.botium.at)

## Requirements
* **Node.js and NPM**
* a **Einstein bot**
* a **project directory** on your workstation to hold test cases and Botium configuration

## Install Botium and Einstein Connector

When using __Botium CLI__:

```
> npm install -g botium-cli
> npm install -g botium-connector-einsteinbot
> botium-cli init
> botium-cli run
```

When using __Botium Bindings__:

```
> npm install -g botium-bindings
> npm install -g botium-connector-einsteinbot
> botium-bindings init mocha
> npm install && npm run mocha
```

When using __Botium Box__:

_Already integrated into Botium Box, no setup required_

## Connecting Einstein chatbot to Botium

You have to collect some information from your Salesforce instance - see capabilities description below.

Create a botium.json in your project directory, filling in the required information:

```
{
"botium": {
"Capabilities": {
"PROJECTNAME": "",
"CONTAINERMODE": "einsteinbot",
"EINSTEINBOT_ENDPOINT": "xxx",
"EINSTEINBOT_ORGANIZATION_ID": "xxx",
"EINSTEINBOT_DEPLOYMENT_ID": "xxx",
"EINSTEINBOT_CHATBUTTON_ID": "xxx"
}
}
}
```

To check the configuration, run the emulator (Botium CLI required) to bring up a chat interface in your terminal window:

```
> botium-cli emulator
```

Botium setup is ready, you can begin to write your [BotiumScript](https://github.com/codeforequity-at/botium-core/wiki/Botium-Scripting) files.

### Cleanup Salesforce Live Chat Transcrips

The Live Chat Transcripts generated by the Botium Tests will count against your Salesforce data storage limits (check it in Service Setup | Settings | Data | Storage Usage). To delete it you can use the Salesforce Dataloader, or if you don't want to install it:

* Open the [Salesforce Workbench](https://workbench.developerforce.com/) and login
* Use the Queries / SOQL option to download the Salesforce ids of LiveChatTranscript (_SELECT Id FROM LiveChatTranscript_), LiveChatTranscriptEvent (_SELECT Id FROM LiveChatTranscriptEvent_) and LiveChatVisitor (_SELECT Id FROM LiveChatVisitor_) as _Bulk CSV_
* Use the Queries / Delete option to upload the CSV files and delete **ALL THE RECORDS FROM THE BEFORE MENTIONED TABLES** (be very careful)
* In Salesforce, use the _Recycle Bin_ to finally delete those records

## Supported Capabilities

Set the capability __CONTAINERMODE__ to __einsteinbot__ to activate this connector.

### EINSTEINBOT_ENDPOINT
Chat API Endpoint

Find it in Salesforce: Service Setup | Channels | Chat | Chat-Settings

### EINSTEINBOT_ORGANIZATION_ID
Organization Id

Find it in Salesforce: Setup | Company Settings | Company information

### EINSTEINBOT_DEPLOYMENT_ID
Deployment Id

Find it in Salesforce: Service Setup | Channels | Chat | Deployments, click on deployment and get it from the page url (address=%2F)

### EINSTEINBOT_CHATBUTTON_ID
Chatbot Button Id

Find it in Salesforce: Service Setup | Channels | Chat | Chat Buttons, click on button and get it from the page url (address=%2F)

### EINSTEINBOT_VISITORNAME
Visitor name (optional)

Visitor name to be used for the Botium conversations