We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9adbf0 commit 4243c3aCopy full SHA for 4243c3a
examples/webhooks_example.py
@@ -0,0 +1,19 @@
1
+''' Webhooks parser usage example. '''
2
+
3
+from livechat.webhooks.parser import parse_webhook
4
5
+webhook_example = {
6
+ 'webhook_id': '166c029b-a2c6-4010-aa0c-5a984353a7dd',
7
+ 'secret_key': 'top_secret_value',
8
+ 'action': 'chat_deactivated',
9
+ 'organization_id': 'f9c7cc55-b35a-4e76-b0d5-ae9fce362314',
10
+ 'payload': {
11
+ 'chat_id': 'PJ0MRSHTDG',
12
+ 'thread_id': 'K600PKZON8'
13
+ },
14
+ 'additional_data': {}
15
+}
16
17
+parsed_wh = parse_webhook(webhook_example)
18
+print(f'Webhook action: {parsed_wh.action}')
19
+print(f'Chat ID from the webhook\'s payload: {parsed_wh.payload.chat_id}')
0 commit comments