Skip to content

sanghunka/pyswit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyswit: Python + Swit.io

Python library for Swit.io RESTful API

PyPI PyPI download month PyPI format PyPI pyversions PyPI license


Requirements

This library requires Python 3.6 or later.

Installation

$ pip install pyswit

Authentication

Examples

from pyswit import Pyswit

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")

Webhook

Pyswit supports webhook.

Webhook API does not require access token

curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"}' <your_webhook_url>

The above curl request can be implemented with pyswit as follows.

from pyswit.webhook import webhook

webhook_url="<your_webhook_url>"
webhook(url=webhook_url, text="Hello, World!")

Documentation

Swit.io Developer documentation

  • Currently, Pyswit supports the following API.
HTTP endpoint pyswit
Users GET user.info
Workspaces GET workspace.info
GET workspace.list
POST workspace.update
GET workspace.user.info
GET workspace.user.list
POST workspace.user.update
Channels POST channel.archive
POST channel.create
POST channel.createDirect
GET channel.info
GET channel.list
POST channel.update
Messages POST message.comment.create
GET message.comment.list
POST message.comment.remove
POST message.create
GET message.info
GET message.list
POST message.reaction.create
POST message.reaction.remove
POST message.remove
Ideas POST idea.comment.create
GET idea.comment.list
POST idea.comment.remove
POST idea.create
GET idea.info
GET idea.list
POST idea.remove
POST idea.reaction.create
POST idea.reaction.remove
Projects POST project.archive
POST project.create
GET project.info
GET project.list
GET project.tagList
POST project.update
GET project.user.list
Project buckets POST project.bucket.create
GET project.bucket.info
GET project.bucket.list
POST project.bucket.update
Tasks POST task.assignee.add
POST task.asignee.remove
POST task.checklist.create
GET task.checklist.info
GET task.checklist.list
POST task.checklist.remove
POST task.checklist.update
POST task.comment.create
GET task.comment.list
POST task.comment.remove
POST task.comment.update
POST task.create
POST task.follow.add
POST task.follow.remove
GET task.info
GET task.list
GET task.listByColumn
POST task.move
GET task.myTaskList
POST task.remove
POST task.update
Posts
Boards
Custom fileds
Approvals
  • Advanced Only API: Posts, Boards, Custom fileds, Approvals
  • Pyswit has no plan to support Advanced Only API