-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexamples.py
More file actions
21 lines (15 loc) · 635 Bytes
/
examples.py
File metadata and controls
21 lines (15 loc) · 635 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from pyswit import Pyswit
# How to get access token: https://developers.swit.io/documentation#authentication
access_token = "<your access token>"
swit = Pyswit(access_token)
# User
print(swit.user.info())
# Create a message
channel_id = "<your_channel_id>" # not channel name
response = swit.message.create(channel_id=channel_id, content="Hello World")
# Get message_id
message_id = response["data"]["message"]["message_id"]
# React to a message
swit.message.reaction.create(message_id=message_id, reaction_name=":smile:")
# Comment on a message
swit.message.comment.create(message_id=message_id, content="Comment string here")