I created my own box with Python Script so that I can post a message from Pepper to ChatWork, so I will introduce it. By using this box, you can put a mechanism in your application to send arbitrary message data to ChatWork.
For example, if you are using Pepper at the reception desk, if you select a person who is making an appointment, a message addressed to that person will be sent to the chat work, or Pepper's murmur will be sent to the chat work at regular intervals in the solitary state. Various uses are possible.
We have prepared a link at the bottom and published the sample application and box on Github, so please refer to that. I won't put it here, but the box code itself is very simple. (Please feel free to expand)
Enter an arbitrary string in "Text Edit" and send the value to the box called "ChatWork POST". After that, use the Python module called urllib2 from that box on the receiving side to set the header information and data and send the request.
Handle exceptions with except.
For detailed information on ChatWork API such as endpoints, please refer to this document.
I'm not doing anything special, so I think GET and other public Web APIs are also typed.
When sending, it is necessary to set the endpoint and API token, but here it is possible to input the dialog as a "variable" of the box. Click the spanner icon in the box and enter each.
name | type | detail |
---|---|---|
Room | String | Room ID |
API-Token | String | Used for authentication |
Please also refer to the "ChatWork API documentation" for how to obtain an API token. The room ID has a unique value set for each chat room.
It will be executed when it is ready.
** Character strings flow from "TextEdit" ~ **
** Posted on "ChatWork" ~ **
** The response is returned in the following JSON format ~ **
{
"message_id": 1234
}
** End ~ **
https://github.com/king-panda/chatwork_post
Mac OS X v10.8.5
Choregraphe v2.1.2.17
Windows has not been confirmed to work.
Recommended Posts