What type of API does Chatwork provide?
Chatwork API Type
- Chatwork API is designed according to the REST architectural style.
Key Characteristics of Chatwork's REST API
- It uses unique URIs (endpoints) for each API resource.
- Interactions are done through HTTP request methods like GET, POST, PUT, and DELETE.
- The base URI for the API endpoint is
https://api.chatwork.com/v2
.
- Specific endpoints are added to this base URI (e.g.,
https://api.chatwork.com/v2/me
).
Additional Information
- The API documentation mentions potential future version updates, where the "/v2" part of the path may be modified.
- A transition period will be provided when API versions are updated.
REST API Characteristics (General)
- Multiple endpoint URLs to define resources.
- Follows a server-driven architecture.
- Automatically puts caching into effect.
- Generally has a less difficult learning curve compared to some other API styles.
Does the Chatwork API have webhooks?
Yes, the official Chatwork API does have webhooks. Here are the key points about Chatwork's webhook functionality:
Webhook Support
Chatwork offers webhook support as part of its API. This allows you to receive real-time notifications of events in Chatwork without having to periodically poll the API.
Event Types
You can subscribe to the following types of events via Chatwork webhooks:
- Sending messages
- Editing messages
- Being mentioned in a message
Webhook Configuration
- Webhook URLs can be set from the API control screen in Chatwork.
- You can specify which chatrooms (group chat, direct chat, my chat) you want to receive notifications for.
Webhook Request Structure
When an event occurs, Chatwork sends an HTTPS POST request to your specified webhook URL with the following structure:
webhook_setting_id
: The ID of the webhook setting
webhook_event_type
: The type of webhook event
webhook_event_time
: The time when the event was recorded (in epoch seconds)
webhook_event
: A JSON object containing details about the event
The webhook requests include the following headers:
content-type: application/json
user-agent: ChatWork-Webhook/<version>
x-chatworkwebhooksignature: <signature>
Benefits
Using webhooks allows you to create functions that can link with external services, such as interactive bots that can operate inside Chatwork.
By utilizing webhooks, you can receive real-time updates about activities in your Chatwork rooms without having to constantly query the API, making your integrations more efficient and responsive.
Rate Limits and other limitations
Here are the key points about the API Rate Limits for the Chatwork API:
General Rate Limit
- The number of API requests is limited to 300 times in 5 minutes [1].
- This limit may change in the future [1].
The API returns the following headers with each response to help track rate limit usage [1]:
x-ratelimit-limit
: Maximum number of calls you can make in the time frame
x-ratelimit-remaining
: Remaining number of calls you can make
x-ratelimit-reset
: Time at which the limit will next be reset (Unix time)
Exceeding the Rate Limit
- If you exceed the rate limit, the API will return a response with status code 429 [1].
Free Plan Limitations
For users on the Free Plan, there are additional limitations [1]:
- Only the past 40 days and 5,000 messages per organization are accessible.
- This limitation affects the following APIs:
- GET:
/rooms/{room_id}/messages
- GET:
/rooms/{room_id}/messages/{message_id}
Best Practices
- Monitor the rate limit headers to avoid exceeding limits.
- Implement backoff and retry logic when receiving 429 responses.
- For Free Plan users, be aware of the message access limitations.
Additional Notes
- The API requires HTTPS connections [1].
- Authentication is done using an API token in the
x-chatworktoken
header [1].
- The base URI for API endpoints is
https://api.chatwork.com/v2
[1].
It's important to note that these rate limits are specific to the Chatwork API and may change over time. Always refer to the most up-to-date official documentation for the latest information on rate limits and API usage.
Latest API Version
Based on the search results provided, here are the key points regarding the most recent version of the Chatwork API:
Current API Version
The most recent version of the Chatwork API is v2 [1][2]. This can be seen from the following information:
- The base URI for the API endpoint is
https://api.chatwork.com/v2
[1].
- The documentation refers to "Chatwork API v2" in multiple places [5].
Key Points
- The API is designed according to the REST architectural style [1].
- Each API resource has a unique URI, called an API endpoint [1].
- The full endpoint is constructed by adding the specific endpoint path to the base URI (e.g.,
https://api.chatwork.com/v2/me
) [1].
- The API supports HTTP request methods such as GET, POST, PUT, and DELETE [1].
API Documentation
- The official API documentation is available in PDF format at http://download.chatwork.com/ChatWork_API_Documentation.pdf [2].
- There's also a Japanese version of the documentation available at http://developer.chatwork.com/ja/ [2].
- A more up-to-date reference for API endpoints can be found at https://developer.chatwork.com/reference/ [2].
API Client Libraries
There are third-party client libraries available for the Chatwork API, such as:
- A Node.js client library called "chatwork-api-client" which supports all endpoints of Chatwork API v2 and includes TypeScript definitions [5].
Future Updates
The documentation mentions that when the API version is updated in the future, the "/v2" part of the path will be modified. Users will be given a transition time to accommodate any changes when an API version is updated [1].
It's important to note that while v2 is the current version, always check the official Chatwork documentation for the most up-to-date information on API versions and endpoints.
How to get a Chatwork developer account and API Keys?
To get a developer account for Chatwork and create an API integration, you'll need to follow these steps:
-
Sign up for a Chatwork account:
-
Apply for API access:
-
Get your API token:
- Once generated, you'll see your API token on the same page.
- Keep this token secure, as it provides access to your Chatwork account via the API.
-
Familiarize yourself with the API documentation:
-
Start integrating:
What can you do with the Chatwork API?
Based on the Chatwork API documentation, here are the main data models you can interact with using the Chatwork API:
Rooms
- Get a list of all chat rooms
- Create a new chat room
- Get details of a specific room
- Update room information
- Delete a room
Key points for Rooms:
- Includes group chats, direct chats, and my chat
- Can access messages, members, files, and tasks associated with a room
Messages
- Get messages in a room
- Post a new message
- Get details of a specific message
- Edit a message
- Delete a message
Key points for Messages:
- Can retrieve up to 100 messages at a time
- Includes information like message ID, sender, body, timestamp
Tasks
- Get tasks in a room
- Create a new task
- Get details of a specific task
- Update task status
Key points for Tasks:
- Can filter tasks by assignee, creator, and status
- Includes information like task ID, assignee, due date, status
Files
- Get files in a room
- Upload a new file
- Get details of a specific file
Key points for Files:
- Can retrieve up to 100 files at a time
- Includes information like file ID, uploader, filename, size
Contacts
- Get incoming contact requests
- Accept/decline contact requests
My Account
- Get my account information
- Get my tasks
- Get my status (unread counts)
Other Users
- Get information about other users
Summary
The Chatwork API allows you to interact with various aspects of the Chatwork platform, including managing rooms, messages, tasks, files, and contacts. It provides both read and write access to these data models, enabling you to build integrations and automate workflows within Chatwork.