or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

administration.mdassets.mdchannels.mdchat.mddirect-messages.mdgroups.mdindex.mdintegrations.mdlivechat.mdmiscellaneous.mdpermissions.mdroles.mdrooms.mdsettings.mdstatistics.mdsubscriptions.mdteams.mdusers.md

livechat.mddocs/

0

# LiveChat

1

2

Customer support and live chat functionality for external visitor engagement. Provides tools for visitor management, inquiry handling, agent assignment, and customer service workflows.

3

4

## Capabilities

5

6

### Visitor Management

7

8

```python { .api }

9

def livechat_register_visitor(self, token, **kwargs):

10

"""

11

Register a new livechat visitor.

12

13

Parameters:

14

- token (str): Visitor token

15

- name (str, optional): Visitor name

16

- email (str, optional): Visitor email

17

- department (str, optional): Department ID

18

- phone (str, optional): Phone number

19

- customFields (dict, optional): Custom visitor fields

20

21

Returns:

22

requests.Response: Visitor registration result

23

"""

24

25

def livechat_get_visitor(self, token):

26

"""

27

Get visitor information.

28

29

Parameters:

30

- token (str): Visitor token

31

32

Returns:

33

requests.Response: Visitor information

34

"""

35

```

36

37

### Room and Session Management

38

39

```python { .api }

40

def livechat_room(self, token, **kwargs):

41

"""

42

Get livechat room or create new session.

43

44

Parameters:

45

- token (str): Visitor token

46

- rid (str, optional): Existing room ID

47

- agentId (str, optional): Specific agent ID

48

49

Returns:

50

requests.Response: Room information

51

"""

52

53

def livechat_rooms(self, **kwargs):

54

"""

55

List livechat rooms.

56

57

Parameters:

58

- agents (list, optional): Filter by agent IDs

59

- departmentId (str, optional): Filter by department

60

- open (bool, optional): Filter by open status

61

- createdAt (dict, optional): Date range filter

62

- closedAt (dict, optional): Date range filter

63

- tags (list, optional): Filter by tags

64

- offset (int, optional): Number of items to skip

65

- count (int, optional): Number of items to return

66

- sort (dict, optional): Sort criteria

67

68

Returns:

69

requests.Response: List of livechat rooms

70

"""

71

```

72

73

### Message Management

74

75

```python { .api }

76

def livechat_message(self, token, rid, msg, **kwargs):

77

"""

78

Send livechat message.

79

80

Parameters:

81

- token (str): Visitor token

82

- rid (str): Room ID

83

- msg (str): Message text

84

- agent (dict, optional): Agent information

85

- file (dict, optional): File attachment

86

87

Returns:

88

requests.Response: Message sending result

89

"""

90

91

def livechat_messages_history(self, rid, token, **kwargs):

92

"""

93

Get livechat message history.

94

95

Parameters:

96

- rid (str): Room ID

97

- token (str): Visitor token

98

- end (str, optional): End date

99

- limit (int, optional): Message limit

100

- ls (str, optional): Last seen timestamp

101

102

Returns:

103

requests.Response: Message history

104

"""

105

```

106

107

### Inquiry Management

108

109

```python { .api }

110

def livechat_inquiries_list(self, **kwargs):

111

"""

112

List open livechat inquiries.

113

114

Parameters:

115

- department (str, optional): Filter by department

116

- offset (int, optional): Number of items to skip

117

- count (int, optional): Number of items to return

118

- sort (dict, optional): Sort criteria

119

120

Returns:

121

requests.Response: List of inquiries

122

"""

123

124

def livechat_inquiries_take(self, inquiry_id, **kwargs):

125

"""

126

Take/assign an inquiry to current agent.

127

128

Parameters:

129

- inquiry_id (str): Inquiry ID to take

130

- userId (str, optional): Agent user ID

131

132

Returns:

133

requests.Response: Assignment result

134

"""

135

```

136

137

### Agent and Manager Management

138

139

```python { .api }

140

def livechat_get_users(self, user_type, **kwargs):

141

"""

142

Get livechat agents or managers.

143

144

Parameters:

145

- user_type (str): User type ('agent' or 'manager')

146

- offset (int, optional): Number of items to skip

147

- count (int, optional): Number of items to return

148

149

Returns:

150

requests.Response: List of users

151

"""

152

153

def livechat_create_user(self, user_type, **kwargs):

154

"""

155

Create livechat agent or manager.

156

157

Parameters:

158

- user_type (str): User type ('agent' or 'manager')

159

- username (str): Username

160

- email (str): Email address

161

- name (str): Full name

162

163

Returns:

164

requests.Response: User creation result

165

"""

166

167

def livechat_get_user(self, user_type, user_id, **kwargs):

168

"""

169

Get livechat agent or manager information.

170

171

Parameters:

172

- user_type (str): User type ('agent' or 'manager')

173

- user_id (str): User ID

174

175

Returns:

176

requests.Response: User information

177

"""

178

179

def livechat_delete_user(self, user_type, user_id):

180

"""

181

Delete livechat agent or manager.

182

183

Parameters:

184

- user_type (str): User type ('agent' or 'manager')

185

- user_id (str): User ID to delete

186

187

Returns:

188

requests.Response: Deletion result

189

"""

190

```

191

192

## LiveChat Object Structures

193

194

```python { .api }

195

VisitorObject = {

196

"_id": "str", # Visitor ID

197

"token": "str", # Visitor token

198

"name": "str", # Visitor name

199

"email": "str", # Visitor email

200

"phone": "str", # Phone number

201

"department": "str", # Department ID

202

"customFields": "dict", # Custom fields

203

"userAgent": "str", # Browser user agent

204

"ip": "str", # IP address

205

"createdAt": "datetime" # Registration timestamp

206

}

207

208

LiveChatRoomObject = {

209

"_id": "str", # Room ID

210

"fname": "str", # Room display name

211

"t": "str", # Room type ('l' for livechat)

212

"v": "VisitorObject", # Visitor information

213

"servedBy": "UserObject", # Assigned agent

214

"departmentId": "str", # Department ID

215

"open": "bool", # Room open status

216

"tags": ["str"], # Room tags

217

"createdAt": "datetime", # Creation timestamp

218

"closedAt": "datetime", # Close timestamp

219

"lastMessage": "MessageObject", # Last message

220

"metrics": { # Room metrics

221

"chatDuration": "int",

222

"responseTime": "dict"

223

}

224

}

225

226

InquiryObject = {

227

"_id": "str", # Inquiry ID

228

"rid": "str", # Room ID

229

"name": "str", # Visitor name

230

"email": "str", # Visitor email

231

"subject": "str", # Inquiry subject

232

"department": "str", # Department ID

233

"message": "str", # Initial message

234

"status": "str", # Inquiry status

235

"ts": "datetime", # Timestamp

236

"agents": ["str"], # Available agents

237

"locked": "bool", # Lock status

238

"lockedBy": "UserObject" # Locked by agent

239

}

240

```

241

242

## Usage Examples

243

244

```python

245

# Register a new visitor

246

visitor_token = "unique_visitor_token"

247

visitor_response = rocket.livechat_register_visitor(

248

token=visitor_token,

249

name="John Customer",

250

email="john@example.com",

251

customFields={"source": "website"}

252

)

253

254

# Create or get livechat room

255

room_response = rocket.livechat_room(token=visitor_token)

256

room_id = room_response.json()['room']['_id']

257

258

# Send a message from visitor

259

rocket.livechat_message(

260

token=visitor_token,

261

rid=room_id,

262

msg="Hello, I need help with my account"

263

)

264

265

# Agent takes an inquiry

266

inquiries = rocket.livechat_inquiries_list()

267

if inquiries.json()['inquiries']:

268

inquiry_id = inquiries.json()['inquiries'][0]['_id']

269

rocket.livechat_inquiries_take(inquiry_id)

270

271

# Get message history

272

history = rocket.livechat_messages_history(room_id, visitor_token)

273

```