From 2620e2d9141e305a96a0cd4be5118a89810376c4 Mon Sep 17 00:00:00 2001 From: Bruno MATEU Date: Sat, 15 Mar 2025 04:25:10 +0100 Subject: [PATCH 1/3] Updates to webhook api - Webhook can now post in threads - Webhook now returns a JSON representation of the message instead of "OK" --- site/content/integrate/webhooks/incoming/_index.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/site/content/integrate/webhooks/incoming/_index.md b/site/content/integrate/webhooks/incoming/_index.md index 7890a102e0..9624469d14 100644 --- a/site/content/integrate/webhooks/incoming/_index.md +++ b/site/content/integrate/webhooks/incoming/_index.md @@ -56,15 +56,15 @@ A successful request will get the following response: ``` HTTP/1.1 200 OK -Content-Type: text/plain +Content-Type: application/json X-Request-Id: hoan6o9ws7rp5xj7wu9rmysrte X-Version-Id: 4.7.1.dev.12799cd77e172e8a2eba0f9091ec1471.false Date: Sun, 04 Mar 2018 17:19:09 GMT Content-Length: 2 - -ok ``` +Followed by a JSON representation of the created message. This representation follows the format used by the [Create Post API endpoint](https://api.mattermost.com/#tag/posts/operation/CreatePost). + All webhook posts will display a `BOT` indicator next to the username in Mattermost clients to help prevent against {{< newtabref href="https://en.wikipedia.org/wiki/Phishing" title="phishing attacks" >}}. @@ -76,6 +76,7 @@ Incoming webhooks support more than just the `text` field. Here is a full list o |---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------| | `text` | {{}} message to display in the post.
To trigger notifications, use `@`, `@channel`, and `@here` like you would in other Mattermost messages. | If `attachments` is not set, yes | | `channel` | Overrides the channel the message posts in. Use the channel's name and not the display name, e.g. use `town-square`, not `Town Square`.
Use an "@" followed by a username to send to a Direct Message.
Defaults to the channel set during webhook creation.
The webhook can post to any Public channel and Private channel the webhook creator is in.
Posts to Direct Messages will appear in the Direct Message between the targeted user and the webhook creator. | No | +| `username` | Root message of the thread the message posts in. | No | | `username` | Overrides the username the message posts as.
Defaults to the username set during webhook creation; if no username was set during creation, `webhook` is used.
The {{}} configuration setting must be enabled for the username override to take effect. | No | | `icon_url` | Overrides the profile picture the message posts with.
Defaults to the URL set during webhook creation; if no icon was set during creation, the standard webhook icon ({{}}) is displayed.
The {{}} configuration setting must be enabled for the icon override to take effect. | No | | `icon_emoji` | Overrides the profile picture and `icon_url` parameter.
Defaults to none and is not set during webhook creation.
The expected value is an emoji name as typed in a message, either with or without colons (`:`).
The {{}} configuration setting must be enabled for the override to take effect.. | No | From 38f0430a17e364b8331079e5f9094d17d0a7246a Mon Sep 17 00:00:00 2001 From: Bruno MATEU Date: Wed, 19 Mar 2025 17:30:07 +0100 Subject: [PATCH 2/3] fix typo in webhook doc --- site/content/integrate/webhooks/incoming/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/content/integrate/webhooks/incoming/_index.md b/site/content/integrate/webhooks/incoming/_index.md index 9624469d14..2f6a56a612 100644 --- a/site/content/integrate/webhooks/incoming/_index.md +++ b/site/content/integrate/webhooks/incoming/_index.md @@ -76,7 +76,7 @@ Incoming webhooks support more than just the `text` field. Here is a full list o |---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------| | `text` | {{}} message to display in the post.
To trigger notifications, use `@`, `@channel`, and `@here` like you would in other Mattermost messages. | If `attachments` is not set, yes | | `channel` | Overrides the channel the message posts in. Use the channel's name and not the display name, e.g. use `town-square`, not `Town Square`.
Use an "@" followed by a username to send to a Direct Message.
Defaults to the channel set during webhook creation.
The webhook can post to any Public channel and Private channel the webhook creator is in.
Posts to Direct Messages will appear in the Direct Message between the targeted user and the webhook creator. | No | -| `username` | Root message of the thread the message posts in. | No | +| `root_id` | Root message of the thread the message posts in. | No | | `username` | Overrides the username the message posts as.
Defaults to the username set during webhook creation; if no username was set during creation, `webhook` is used.
The {{}} configuration setting must be enabled for the username override to take effect. | No | | `icon_url` | Overrides the profile picture the message posts with.
Defaults to the URL set during webhook creation; if no icon was set during creation, the standard webhook icon ({{}}) is displayed.
The {{}} configuration setting must be enabled for the icon override to take effect. | No | | `icon_emoji` | Overrides the profile picture and `icon_url` parameter.
Defaults to none and is not set during webhook creation.
The expected value is an emoji name as typed in a message, either with or without colons (`:`).
The {{}} configuration setting must be enabled for the override to take effect.. | No | From 7b281ef6f3f23dece586b82b1895eb709570e5de Mon Sep 17 00:00:00 2001 From: Bruno MATEU Date: Thu, 17 Apr 2025 08:53:59 +0200 Subject: [PATCH 3/3] Revert webhook returns json representation of the message From 2620e2d9141e305a96a0cd4be5118a89810376c4 --- site/content/integrate/webhooks/incoming/_index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/site/content/integrate/webhooks/incoming/_index.md b/site/content/integrate/webhooks/incoming/_index.md index 2f6a56a612..ebed3abde8 100644 --- a/site/content/integrate/webhooks/incoming/_index.md +++ b/site/content/integrate/webhooks/incoming/_index.md @@ -56,14 +56,14 @@ A successful request will get the following response: ``` HTTP/1.1 200 OK -Content-Type: application/json +Content-Type: text/plain X-Request-Id: hoan6o9ws7rp5xj7wu9rmysrte X-Version-Id: 4.7.1.dev.12799cd77e172e8a2eba0f9091ec1471.false Date: Sun, 04 Mar 2018 17:19:09 GMT Content-Length: 2 -``` -Followed by a JSON representation of the created message. This representation follows the format used by the [Create Post API endpoint](https://api.mattermost.com/#tag/posts/operation/CreatePost). +ok +``` All webhook posts will display a `BOT` indicator next to the username in Mattermost clients to help prevent against {{< newtabref href="https://en.wikipedia.org/wiki/Phishing" title="phishing attacks" >}}.