forked from ringcentral/engage-digital-source-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost_message_demo.py
More file actions
42 lines (37 loc) · 911 Bytes
/
post_message_demo.py
File metadata and controls
42 lines (37 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
from dotenv import load_dotenv
load_dotenv()
from ringcentral_engage_digital_source_sdk import postMessageToEngage
from datetime import datetime
import string
import random
def uid ():
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(10))
def main ():
url = ''
body = {
'action': 'messages.create',
'params': {
'actions': ['show', 'reply'],
'id': uid(),
'body': 'hi there~' + uid(),
'thread_id': uid(),
'author': {
'id': uid(),
'firstname': 'John',
'lastname': 'Doe',
'screenname': 'John Doe',
'created_at': 1622426621537
}
}
}
token = ''
try:
url = os.environ['RINGCENTRAL_ENGAGE_DIGITAL_ENDPOINT']
token = os.environ['RINGCENTRAL_ENGAGE_DIGITAL_API_TOKEN']
except:
pass
r = postMessageToEngage(body, url, token)
print('result', r)
main()