Querying The Engagement History API With Firefox RESTClient

Querying The Engagement History API With Firefox RESTClient

 

The Engagement History API is a REST API that allows a Brand to search, filter, and keep copies of chat transcripts and the related data, such as visitor information, agent information, and much more. In order to use the Engagement History API, you must have a set of API keys installed on your account. You can contact your LivePerson account team or LivePerson support to get your API keys provisioned.

 

99.5 % of chat transcript data is available within 5 minutes. All other chat transcript data, including metadata, for example, Engagement Attributes, is available within 2 hours after a chat has ended, and is stored for 13 months.

 

Once you have these keys installed on your account, you will be able to start using the API. To get started, all you need to do is send a POST request with an OAuth 1.0 Authorization header.

 

If you are not familar with OAuth 1.0, you can read more about it here: http://oauth.net/core/1.0/

 

For this example, we will be using the the RESTClient plugin for Firefox.

 

2016-02-10_1509.png

 

You can read more about the plugin here: Firefox RESTClient Plugin

 

Find Your Domain

 

To make request to the Engagement History API, you will need to know what domain your account is on. To find your domain, you will need to put this URL in the URL field, and make sure you replace {accountID} with your account ID.

 

https://api.liveperson.net/api/account/{accountID}/service/engHistDomain/baseURI.json?version=1.0

 

Make sure you select GET in the method drop down box.

2016-03-25_1222.png

 

Once you click the send button, you should get a response similar to this:

 

2016-02-10_1514.png

 

The baseURI is the domain for your account. Now that you have this, you can start making API calls.

 

Headers

 

To call the API, the first thing you will need to do is add an OAuth header. To add an OAuth Header, click on Authentication and choose OAuth from the drop down menu.

 

2016-02-10_1524.png

 

In the OAuth window, on the Signature for this request tab, enter the following information:

  • Consumer key - This is your App Key ID

  • Consumer secret - This is your App Key Secret

  • Access token - This is access token you get when the key installed into your account.

  • Access token secret - This is access token secret you get when the key installed into your account.

 

It is recommended that you click the ‘Remember the setting’ checkbox that way you will not need to enter this information each time you want to make an API call.

 

Click on the OAuth setting tab and enter the following information:

  • Signature Methods - Choose HMAC-SHA1 from the drop down menu

  • oAuth Version - Choose 1.0 from the drop down menu

  • Realm - Click the disabled checkbox

  • oAuth Nonce - Click the Auto checkbox

  • oAuth Timestamp - Click the Auto checkbox

 

2016-03-25_1235.png

 

Click the Save button and then go back to the Signature for this request tab and click the Insert button.

 

The next thing you need to add to your API call is a custom header. To add a custom header, click on Headers and from the drop down menu choose Custom Header.

 

2016-02-10_1530.png

 

In the Request Header window enter the following information:

  • Name: Content-Type

  • Value: application/json

 

It is recommended that you click the ‘Save to favorite’ checkbox that way you can use this header in future requests without having to re-create it.

 

Click the Okay button.

 

Querying The API

 

To query the API, you will need to put this URL in the URL field and make sure you replace {accountID} with your account ID, and {domain} with your domain.

 

https://{domain}/interaction_history/api/account/{accountID}/interactions/search?offset=0&limit=10

 

In the method drop down box choose POST.

 

The last thing you need to add to the POST request is the Body. For the Body you are required to add in the time frame you would like to pull data for. You can also add in any other parameters from the documentation you would like.

 

Here is an example body:

{

"start":{

"from":1433140200000,"to":1435645800000

}

}

 

The time frame must be entered in epoch time in milliseconds.

 

2016-03-25_1253.png

 

Click the Send button and you should see a similar response:

 

2016-03-25_1302.png

 

If you get a 200 OK status Code response, that means your query was successful. If you click on the Response Body (Highlight) tab, you can see a formatted view of the data that was returned.

 

2016-03-23_1012.png

 

Saving Your API Request

 

If you will be making more Engagement History API requests with the RESTClient, you can save your request for future use. To do this, click on Favorite Requests, and from the drop down menu choose Save Current Request.

2016-02-10_1546.png

 

A new pop up menu will appear with an option to name the current request. Once you enter the name, just click save.

 

To use the request later, just navigate to the top of the RESTClient and click on Favorite Requests, and then from the drop down menu choose the request that you just saved.

 

This post, based on feedback from LiveEngage users, is meant to offer you guidance and to help drive value for your brand.

 

More Resources

 

You can read more about the Engagement History API here:Engagement History API PDF

Best Practices - Engagement History API: Engagement History API Best Practices

You can read more about using the RESTClient here: https://connect.liveperson.com/content/troubleshooting-apis