Contents
Incoming Webhooks
Incoming Webhooks allow external bots, apps, and services to post messages to specific topics on Typetalk.
Message Limitations
Messages can have up to 4,000 characters; consider splitting longer messages. You can also group messages in threads by specifying the ID of the parent message in the ‘replyTo’ parameter when posting.
Integrating an Incoming Webhook
- Select [•••] in the upper right corner of the topic where you want to post a message via Webhook, and open “Topic Settings”.
- Open the “BOTS” tab, and select “Add new”.
- Enter any bot ID and bot name, and select “Create”.
To post:
- Paste the Typetalk token from your bot in the HTTP header
X-TYPETALK-TOKEN
. - Send an HTTP POST request to the “Get or post messages URL”.
Node.js example:
import * as https from 'https'
const payload = JSON.stringify({
message: 'Message you want to post',
})
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-TYPETALK-TOKEN': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
},
}
const webhookurl: 'https://typetalk.com/api/v1/topics/nnnnn'
const request = https.request(webhookUrl, options)
request.write(payload)
request.end()
Get API details about posting.
Deleting an Incoming Webhook
- Select [•••] in the upper right corner of the topic where you want to delete a Webhook, and open “Topic Settings”.
- Open the “BOTS” tab, and select the bot.
- Select “Delete this bot permanently”.