Chatwork Forwarder is Opensource was developed with Laravel framwork, which help your project solve the following probems.
If your project is working with chatwork, you need to process the sending of the message when input data is received or simply happens every day when each member in the project sends a Pull Request they have to TO on the project box to request review merge Pull, this work is repetitive, both boring and time-consuming. Chatwork forwarder will help your project solve those problems extremely quickly, just need a few easy config steps.
Let's go!
Enter the url https://cw-forwarder.sun-asterisk.vn/. This is chatwork-forwarder's landing. We must login with click login button before continue.
After login, we will see Dashboard page that is showing statistics:
This is section that manages the addition and modification of chatwork's bot. As we know, sending message to the chatwork we must have a chatwork account as a Bot, and have to get its API token.
Bot key is Bot-Account's API-token, you can go to API setting in chatwork to get it.
The webhook list screen is the created webhooks, here we can create new webhook or edit an existing webhook.
For example, I will create a webhook for project XYZ to send a message every time a member sends a Pull Request. We will use the bot that created at the beginning and send to myself (If you want to sent to the room you can choose the room type of Group instead of Private).
After save we will redirect to edit webhook
page. Here we will config payloads
, conditions
and mapping
.
URL
is webhook that created to give the services which we want to receive payload. We need copy this url and go to the webhook settings on the project github (Only project's admin can access to this seting).
The
Content type
default isapplicationi/x-www-form-urlencoded
, we need change this toapplication/json
.
Receiving the payload when has some one who send Pull Request.
Enter Update webhook to finish.
This is the most important, that help you config payload, conditions and content to send to chatwork. In each section we have an example (blue color).
To get payload pattern, we go to repo's setting again, in Recent Deliveries
we can see our payload, and copy it.
After copying the sample payload part of a PR, we will paste it into the input Payload params. The condition and content sections we can follow the example so that the system can find and read the data that you want to get in the pasted payload above. For example:
Note: we can user prefix
$params
or not.
After that, we save
and wait for new PR, and this is result:
This is the part that helps you convert data from one value to another, understand that as the above example we have a user_id is 38203330, but you do not want to display it like that, instead 38203330 will display Thi is Quach Dai Phuc. Simply configure in the mapping section as follows:
In the content of the payload we can also configure which time the mapping value.
Keeping original value: {!! \$params.user.display_name !!}
Mapping value with other: {{$params.user.display_name}}
That all, that's how chatwork-forwarder is used, hopefully it will be of great help in your project. Any one can contribute here :
Github https://github.com/sun-asterisk-research/chatwork-forwarder