Skip to content

Commit e686f10

Browse files
committed
Update usage examples and readme links
1 parent ca050c2 commit e686f10

File tree

3 files changed

+16
-91
lines changed

3 files changed

+16
-91
lines changed

README.md

Lines changed: 8 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ For protocol documentation of LiveChat APIs, please go to [Livechat Platform Doc
99
## Technical docs
1010

1111
Agent Chat API:
12-
* [RTM API](https://livechat.github.io/lc-sdk-python/agent_rtm.html)
13-
* [WEB API](https://livechat.github.io/lc-sdk-python/agent_web.html)
12+
* [RTM API](https://livechat.github.io/lc-sdk-python/agent_rtm/index.html)
13+
* [WEB API](https://livechat.github.io/lc-sdk-python/agent_web/index.html)
1414

1515
Customer Chat API:
16-
* [RTM API](https://livechat.github.io/lc-sdk-python/customer_rtm.html)
17-
* [WEB API](https://livechat.github.io/lc-sdk-python/customer_web.html)
16+
* [RTM API](https://livechat.github.io/lc-sdk-python/customer_rtm/index.html)
17+
* [WEB API](https://livechat.github.io/lc-sdk-python/customer_web/index.html)
1818

1919
Management:
20-
* [Configuration API](https://livechat.github.io/lc-sdk-python/configuration_api.html)
20+
* [Configuration API](https://livechat.github.io/lc-sdk-python/configuration/index.html)
2121

2222
Reports:
23-
* [Reports API](https://livechat.github.io/lc-sdk-python/reports_api.html)
23+
* [Reports API](https://livechat.github.io/lc-sdk-python/reports/index.html)
2424

2525
## Installation
2626

@@ -32,91 +32,8 @@ pip install lc-sdk-python
3232

3333
## Usage
3434

35-
### Agent RTM API usage example
36-
37-
Basic example on how to login as an agent and change routing status to `not_accepting_chats`.
38-
39-
First, create your AgentRTM client and log in:
40-
```python
41-
>>> from livechat.agent import AgentRTM
42-
>>> my_agent = AgentRTM.get_client()
43-
>>> my_agent.login(token='Bearer <your bearer token>')
44-
INFO:root:
45-
REQUEST:
46-
{
47-
"action": "login",
48-
"payload": {
49-
"token": "Bearer <your bearer token>
50-
},
51-
"request_id": "5571081909"
52-
}
53-
INFO:root:
54-
RESPONSES:
55-
{
56-
"response": {
57-
"request_id": "5571081909",
58-
"action": "login",
59-
"type": "response",
60-
"payload": {
61-
...
62-
},
63-
"success": true
64-
},
65-
"pushes": []
66-
}
67-
```
68-
69-
Now you can change the routing status of the agent:
70-
71-
```python
72-
>>> my_agent.set_routing_status(status='not_accepting_chats')
73-
INFO:root:
74-
REQUEST:
75-
{
76-
"action": "set_routing_status",
77-
"payload": {
78-
"status": "not_accepting_chats"
79-
},
80-
"request_id": "8214452850"
81-
}
82-
INFO:root:
83-
RESPONSES:
84-
{
85-
"response": {
86-
"request_id": "8214452850",
87-
"action": "set_routing_status",
88-
"type": "response",
89-
"payload": {},
90-
"success": true
91-
...
92-
}
93-
}
94-
```
95-
96-
Finally, log out:
97-
98-
```python
99-
>>> my_agent.logout()
100-
INFO:root:
101-
REQUEST:
102-
{
103-
"action": "logout",
104-
"payload": {},
105-
"request_id": "629300202"
106-
}
107-
INFO:root:
108-
RESPONSES:
109-
{
110-
"response": {
111-
"request_id": "629300202",
112-
"action": "logout",
113-
"type": "response",
114-
"success": true
115-
},
116-
"pushes": []
117-
}
118-
```
119-
35+
Usage examples can be found here:
36+
[examples](https://github.com/livechat/lc-sdk-python/tree/master/examples)
12037

12138
## Feedback
12239

examples/agent_rtm_example.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
response = agent_rtm.start_chat(continuous=True)
99
chat_id = response.payload.get('chat_id')
1010
thread_id = response.payload.get('thread_id')
11+
12+
# Get all messages including the non-response messages (e.g. pushes). Returns a list
13+
incoming_chat_push = agent_rtm.ws.messages[0]
14+
1115
agent_rtm.send_event(chat_id=chat_id,
1216
event={
1317
'type': 'message',

examples/customer_rtm_example.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
response = customer_rtm.start_chat(continuous=True)
1010
chat_id = response.payload.get('chat_id')
1111
thread_id = response.payload.get('thread_id')
12+
13+
# Get all messages including the non-response messages (e.g. pushes). Returns a list
14+
incoming_chat_push = customer_rtm.ws.messages[0]
15+
1216
customer_rtm.send_event(chat_id=chat_id,
1317
event={
1418
'type': 'message',

0 commit comments

Comments
 (0)