How to Connect Gmail and Chatwork to Post Incoming Email Automatically | API Token Steps

Your work happens in Chatwork, yet the important messages arrive only in Gmail. For anyone who wants to cut down on going over to check email, this page explains how to automatically post matching emails to a Chatwork room.

Bottom line

In a Samurai App workflow, use incoming Gmail as the trigger, and call Chatwork's CHATWORK_POST_MESSAGE (post a message) in a "Call external service" step.

You don't use "Send to notification destination." Chatwork's posting API requires an API token in the header, which doesn't fit a notification destination where you only register a URL. Instead, you connect an API token and write from a run with no one present. Deciding how to handle this write up front is the big difference from sending to Slack.

What you can and can't do

Issuing a token may require an application. On any plan other than the Personal plan, you need to apply to your organization's administrator. Waiting for the administrator's approval is where things tend to stall, so apply first.

Posting limits apply per room. Posts and task creations in the same room are limited to 10 combined per 10 seconds, and going over returns a 429. Across everything, the limit is 300 per 5 minutes. If you send email through without filtering, you'll hit it when a batch arrives at once.

The body must be 1 to 65,535 characters. An empty body can't be sent. Pick the fields you insert with emails that have no subject or no body in mind.

Chatwork notation works as is. A Chatwork message body can be wrapped in notation such as [info][title]…[/title]…[/info]. If you insert an email body as is, strings the sender wrote, such as [To:…], go into the post too, so it's safer not to insert body text that arrives from outside.

Gmail can lag by up to 15 minutes. That's because it checks for new mail periodically.

How writes with no one present are handled

A workflow's "Call external service" step calls one fixed operation once, without going through AI. In runs of a published version, it behaves as follows.

  • By default, write operations run without showing an approval card and are kept in the approval records
  • Operations an administrator has set to "Always ask" are refused, because an unattended run has no one to ask
  • Operations set to "Block" are also refused

The post text is exactly what you write in body; AI does not rewrite it. If you want AI to write the text, put a "Generate with AI" step before it.

Also decide which connection it runs with. By default it runs with the connection of the person who started the run, or, for a trigger, the person who created the trigger. If you don't want it to stop when the person in charge changes roles, you can pin the connection with "Lend to this workflow" under the step's "Credentials used for the run."

What you need

  • A Chatwork API token, and an account that is a member of the room you post to
  • Gmail and Chatwork connections in Samurai App's "Connectors"
  • Permission to add service integrations to workflows (Manager or above)

Steps

1. Issue a Chatwork API token

From your user name at the top right of Chatwork, open "Service integration" and issue a token under "API Token" in the left menu. On any plan other than the Personal plan, sign in with the account that will use the API and apply to your organization's administrator.

2. Connect Chatwork and Gmail

Add Chatwork on the "Connectors" screen. When connecting, you're asked for credentials, so enter the token from step 1. Add Gmail on the same screen too, and link it with your own account. Adding connectors is done by administrators and managers.

3. Find the room ID

CHATWORK_POST_MESSAGE takes a room_id, not a room name. You can look it up by asking in chat: "Show me the list of Chatwork rooms and their IDs."

4. Build the workflow

Create a draft with "New," and in "Workflow input" add one named event of type "Group of fields."

Next, add "Call external service" from "Connect," choose CHATWORK_POST_MESSAGE, and fill in the values to pass.

Name Value
room_id The room ID from step 3
body The text below
[info][title]New email: {{input.event.subject}}[/title]From: {{input.event.sender}}[/info]

Click "Save," then publish with "Publish version N" on the "Versions" tab.

5. Add the trigger

On the "Triggers" tab, choose the Gmail connection under "Add service integration," and pick "New Gmail Message Received Trigger" under "When to run." In the query field under "Filter," enter the same conditions you would type in the Gmail search box.

from:billing@example.com -subject:unsubscribe

If you don't filter, every email you receive comes through, each one costs about ¥0.5, and you also get close to Chatwork's posting limit.

6. Test just the post first

Select the CHATWORK_POST_MESSAGE step, open "Try this step" on the "Test" tab, enter values in place of input.event, and click "Try." The external operation really runs, so choose a room meant for testing.

When it doesn't work

  • The step is refused: an administrator has set this operation to "Always ask" or "Block." An unattended run can't be approved, so ask the administrator to change the setting
  • It fails with a 429: posts to the same room exceeded 10 per 10 seconds. Wait about 10 seconds and click "Retry from the failed step" on the run screen. If it keeps happening, narrow the query
  • It fails saying an inserted value is missing: it refers to a field that email doesn't have. Check which fields arrived in the input under "Recent runs"
  • It works when you run it but fails from the trigger: by default it runs with the connection of the person who created the trigger. Have that person connect Chatwork, or pin a connected account with "Lend to this workflow"

Frequently asked questions

Can I register it as a Chatwork task?

Yes. Set the operation to CHATWORK_CREATE_TASK and pass room_id, body, and the assignees' to_ids (comma-separated account IDs). It counts toward the same "10 per 10 seconds" limit as posts.

Can I send attachments to Chatwork too?

These steps only post text. You can insert the list of attachments as JSON text with {{input.event.attachment_list}}, but the files themselves are not posted.

Can a Chatwork message trigger it?

Chatwork is not among the service integration events (as of November 4, 2026). In this article, the direction is Gmail as the trigger and Chatwork as the destination.

Related uses

Sources

Related featureConnect business tools to AI over MCPSamurai App connects your business tools to AI over MCP. Operate accounting and HR SaaS from chat within each person's own permissions, call the agent from Slack or Teams, and use it from outside AI clients over MCP.

More automation examples

See every way to connect and automate Gmail

See every way to connect and automate Chatwork

Back to How-to articles

Everyday work comes together, connects, and becomes the company's strength.

Contact usOpen Samurai App

See the demoContact us