IPTP Developer

Developer

  • Getting started
    • Docker
    • MarkDown
    • Merge
  • ESB
    • Configuration
  • XM
    • API
    • Chats
    • ERP Integration
    • Messages
    • Sync
  • IPTP ID
    • Integration
  • Ugene
    • API
    • Error codes
    • How create plugin
  • Live assistance api
    • API

Live Assistance API Documentation

  1. Create a new Live Assistance chat
  2. Load all previous messages
  3. Get new messages
  4. Send a message
  5. Get guest information

1. Create a new Live Assistance chat

1.1 POST https://xm.iptp.net/xm/guests

To create a new Live Assistance chat.

1.2 Headers

None.

1.3 Parameters

Name Type Description
captchaId string (Required) Id of the captcha obtained at https://xm.iptp.net/xm/captcha.
captcha string (Required) Solved captcha.

1.4 Body

{
    "name": "John Doe",
    "email": "john@foobar.com",
    "departmentId": 2,
    "message": "Hello, I'd like to contact sales team",
    "sourceUrl": "https://www.iptp.net/en_US/iptp-tools/best-path/"
}
Name Type Description
name string (Required) Name of the guest.
email string (Required) Email of the guest.
departmentId string (Required) Id of the department (check here).
message string (Required) Message of the guest.
sourceUrl string URL of the web page where the guest is located.

1.5 Response

Successful HTTP status: 201 (CREATED)

{
    "userId": "b99d2cb550bc",
    "chatId": "e58db7609c2b",
    "access_token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyOTkyZTUwNmVjYzgiLCJpYXQiOjE2MzI0NjIyMjYsImV4cCI6MTYzMjQ2NDAyNn0.cFH6VjWQQYsGsOVvNtstRKLh37h6wltCYx2JH1_kTG89bn30RRcmuY2RdrdkILYTQZubdWUYkzI4uR5we7IxlQ",
    "refresh_token": "46a4518c-15b0-4104-aee5-278db810b109",
}

At this point, server has already created a guest user (with id = userId), and added him to a new chat room (chatId) named “{departmentName}: {guestName}” with IPTP users from department with id = departmentId. Therefore, you can use userId, chatId and access_token to send and get messages.

1.6 Notes

departmentId is defined in the following department list:

departmentId departmentName notes
1 Test To be used for testing porpuses
2 Live assistance To be used on https://www.iptp.net
3 LagBlaster To be used on https://www.lagblaster.com

2. Load all previous messages

Please, see details here.

3. Get new messages

(GET) https://xm.iptp.net/xm/api/sync?timeout=10000&chatId=e58db7609c2b&onBackground=false

There is no need to attach sessionId param for Live Assistance. Server will identify if user is a guest, and won’t require sessionId param.

request body

No request body, but the request should contain an Authorization header:

Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyOTkyZTUwNmVjYzgiLCJpYXQiOjE2MzI0NjIyMjYsImV4cCI6MTYzMjQ2NDAyNn0.cFH6VjWQQYsGsOVvNtstRKLh37h6wltCYx2JH1_kTG89bn30RRcmuY2RdrdkILYTQZubdWUYkzI4uR5we7IxlQ

4. Send message

Please, see details here.

5. Get guest information

5.1 POST /xm/api/chats/#{chatId}/description

Access guest information such as IP Address, language, browser, etc.

5.2 Headers

Name Description
X-Authorization-Token (Required) User’s authorization token returned by server after a successful login.

5.3 Parameters

Name Type Description
chatId string (Required) Id of the chat.

5.4 Sample

Request:

curl --location --request POST 'https://xm.iptp.net/xm/api/chats/e58db7609c2b/description' \
--header 'X-Authorization-Token: j9lehdHFaIpxGBFsDgX...' \
--header 'Content-Type: application/json'

Response:

Successful HTTP status: 200 (OK)

{
	"id": "e58db7609c2b",
	"partner": null,
	"subject": "Live Assistance: Tester2 [#912414]",
	"groupAvatarType": "jpg",
	"lastMessage": null,
	"updated": null,
	"unreadMessages": null,
	"admin": false,
	"members": [],
	"sender": false,
	"group": true,
	"liveAssistance": true,
	"channel": false,
	"guest": {
		"id": "b99d2cb550bc",
		"name": "Tester2",
		"email": "sudcyssztigdwhgkmg@zqrni.net",
		"creationDate": 1630596510638,
		"userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0",
		"ipAddress": "132.251.2.247",
		"language": "en-US,en;q=0.5",
		"browser": "Firefox",
		"browserMajorVersion": "0",
		"platform": "Ubuntu",
		"platformVersion": "Unknown",
		"deviceType": "Desktop",
		"country": "Peru",
		"continent": "South America",
		"flag": "🇵🇪",
		"sourceUrl": null
	}
}