Webhook

Webhook can process any mentions to a bot account. You can set a Webhook URL to your bot account for a specified topic.

  1. Go to the page for editing a topic and create a bot with any ID and name, then set the Webhook URL to the “bot”. We support basic authentication (e.g., http://user:password@example.com/)
  2. In the topic for which you’ve created a bot, you can mention the bot like this: “@bot+ hello, bot.” A “+“sign after the account name indicates that the account is a bot.
  3. POST request to submit the following data to specified Webhook URL. GET request BODY to fetch data in JSON format.
  4. If you want to post a message in the same topic, return JSON response. See Samples.

Example of body request

{
  "topic": {
    "id": 208,
    "name": "IT Peeps",
    "suggestion": "IT Peeps",
    "lastPostedAt": "2014-12-10T09:00:29Z",
    "createdAt": "2014-06-10T02:32:29Z",
    "updatedAt": "2014-06-10T02:32:29Z"
  },
  "post": {
    "id": 333,
    "topicId": 208,
    "replyTo": null,
    "message": "Let's party like it's 1999!",
    "account": {
      "id": 100,
      "name": "jessica",
      "fullName": "Jessica Fitzherbert",
      "suggestion": "Jessica Fitzherbert",
      "imageUrl": "https://typetalk.in/accounts/100/profile_image.png?t=1403577149000",
      "createdAt": "2014-06-24T02:32:29Z",
      "updatedAt": "2014-06-24T02:32:29Z"
    },
    "mention": null,
    "attachments": [],
    "likes": [],
    "talks": [],
    "links": [],
    "createdAt": "2014-12-10T09:00:29Z",
    "updatedAt": "2014-12-10T09:00:29Z"
  }
}

Example of body response

Example of return response for “reply to” message.

{ "message": "Hello!", "replyTo": 100 }

“fileKeys” and “talkIds” follow the same parameters as Post message API.

{
    "message":  "Hello!",
    "replyTo": 100,
    "fileKeys": [ "abcdef", "ghijk" ],
    "talkIds": [ 200, 300 ]
}