Skip to content

Commit c886043

Browse files
authored
Merge branch 'master' into interactive-dialog
2 parents fa0a798 + 9b28c44 commit c886043

File tree

3 files changed

+120
-15
lines changed

3 files changed

+120
-15
lines changed

site/content/integrate/plugins/interactive-messages/_index.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ The following payload gives an example that uses message buttons.
3737
{
3838
"id": "message",
3939
"name": "Ephemeral Message",
40+
"tooltip": "Send a message only visible to you",
4041
"integration": {
4142
"url": "http://127.0.0.1:7357",
4243
"context": {
@@ -46,6 +47,7 @@ The following payload gives an example that uses message buttons.
4647
}, {
4748
"id": "update",
4849
"name": "Update",
50+
"tooltip": "Update this message",
4951
"integration": {
5052
"url": "http://127.0.0.1:7357",
5153
"context": {
@@ -71,6 +73,18 @@ In the HTTP response for this request, the integration can choose to update the
7173
}
7274
```
7375

76+
To return a custom error message to the user, your integration can respond with an error object:
77+
78+
```json
79+
{
80+
"error": {
81+
"message": "Unable to complete action. Please check your permissions."
82+
}
83+
}
84+
```
85+
86+
The error message will be displayed to the user below the message attachment. If no custom error message is provided, a default "Action failed to execute" message is shown. This feature is available in Mattermost v10.5 and later.
87+
7488
![image](interactive_message.gif)
7589

7690
Button actions support a style parameter to change the color of the button. The possible values for style are: `good`, `warning`, `danger`, `default`, `primary`, and `success`. It's also possible to pass a theme variable or a hex color, but we discourage this approach because it won't be resilient against theme changes.
@@ -114,6 +128,51 @@ The actions used in the previous example include the following:
114128
]
115129
```
116130

131+
### Tooltips on buttons
132+
133+
You can add tooltips to provide helpful information when users hover over action buttons:
134+
135+
```json
136+
{
137+
"attachments": [
138+
{
139+
"pretext": "Review this pull request",
140+
"text": "Pull request #1234: Add new feature",
141+
"actions": [
142+
{
143+
"id": "approve",
144+
"type": "button",
145+
"name": "Approve",
146+
"tooltip": "Click to approve this pull request",
147+
"style": "primary",
148+
"integration": {
149+
"url": "http://127.0.0.1:7357",
150+
"context": {
151+
"action": "approve",
152+
"pr_id": 1234
153+
}
154+
}
155+
},
156+
{
157+
"id": "reject",
158+
"type": "button",
159+
"name": "Reject",
160+
"tooltip": "Click to reject this pull request",
161+
"style": "danger",
162+
"integration": {
163+
"url": "http://127.0.0.1:7357",
164+
"context": {
165+
"action": "reject",
166+
"pr_id": 1234
167+
}
168+
}
169+
}
170+
]
171+
}
172+
]
173+
}
174+
```
175+
117176
## Message menus
118177

119178
Similar to buttons, add message menus as `actions` in your integration [message attachments]({{< ref "/integrate/reference/message-attachments" >}}).
@@ -244,6 +303,9 @@ A per post unique identifier.
244303
**Name**<br/>
245304
Give your action a descriptive name.
246305

306+
**Tooltip** (optional)<br/>
307+
Display helpful text when users hover over the button. Available in Mattermost v10.5 and later.
308+
247309
**URL**<br/>
248310
The actions are backed by an integration that handles HTTP POST requests when users select the message button. The URL parameter determines where this action is sent. The request contains an `application/json` JSON string. As of 5.14, relative URLs are accepted, simplifying the workflow when a plugin handles the action.
249311

@@ -336,6 +398,31 @@ In most cases, your integration will do one or both of these things:
336398

337399
Then, when the integration receives the request, it can act based on the action ID.
338400

401+
## Error handling
402+
403+
When an action button integration fails, Mattermost automatically displays an error message to the user below the message attachment. This provides immediate feedback when button actions don't work as expected.
404+
405+
![image](action-button-error.png)
406+
407+
**Key behaviors:**
408+
- Integrations can return custom error messages using the error response format (see above)
409+
- If no custom message is provided, a default "Action failed to execute" message is shown
410+
- Previous errors are automatically cleared when a new action is triggered
411+
- Error display works for both button and menu actions
412+
413+
This feature is available in Mattermost v10.5 and later.
414+
415+
**Automatic error display scenarios:**
416+
417+
When your integration returns an error response with a custom message, that message is displayed to the user. For system-level errors where no custom message can be returned, a default error message is shown:
418+
419+
- Network connection fails when contacting the integration URL
420+
- Integration URL is invalid or unreachable
421+
- Integration returns a non-200 HTTP status code
422+
- Integration returns invalid JSON
423+
424+
For troubleshooting integration errors from the server side, see the FAQ section "Why does an interactive button or menu return a 400 error?" below.
425+
339426
## Tips and best practices
340427

341428
1. The external application may be written in any programming language. It needs to provide a URL which receives the request sent by your Mattermost server and responds within the required JSON format.
58.2 KB
Loading

site/static/mattermost-openapi-v4.yaml

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14418,7 +14418,7 @@ paths:
1441814418
/api/v4/ldap/groups:
1441914419
get:
1442014420
tags:
14421-
- ldap
14421+
- LDAP
1442214422
summary: Returns a list of LDAP groups
1442314423
description: >
1442414424
##### Permissions
@@ -14464,7 +14464,7 @@ paths:
1446414464
/api/v4/ldap/groups/{remote_id}/link:
1446514465
post:
1446614466
tags:
14467-
- ldap
14467+
- LDAP
1446814468
summary: Link a LDAP group
1446914469
description: >
1447014470
##### Permissions
@@ -18704,7 +18704,7 @@ paths:
1870418704
Get a list of remote clusters.
1870518705

1870618706
##### Permissions
18707-
`manage_secure_connections`
18707+
`manage_secure_connections` or `manage_shared_channels`
1870818708
operationId: GetRemoteClusters
1870918709
parameters:
1871018710
- name: page
@@ -18829,7 +18829,7 @@ paths:
1882918829
Get the Remote Cluster details from the provided id string.
1883018830

1883118831
##### Permissions
18832-
`manage_secure_connections`
18832+
`manage_secure_connections` or `manage_shared_channels`
1883318833
operationId: GetRemoteCluster
1883418834
parameters:
1883518835
- name: remote_id
@@ -19052,7 +19052,7 @@ paths:
1905219052
and their status.
1905319053

1905419054
##### Permissions
19055-
`manage_secure_connections`
19055+
`manage_secure_connections` or `manage_shared_channels`
1905619056
operationId: GetSharedChannelRemotesByRemoteCluster
1905719057
parameters:
1905819058
- name: remote_id
@@ -19129,6 +19129,12 @@ paths:
1912919129
required: true
1913019130
schema:
1913119131
type: string
19132+
- name: include_deleted
19133+
in: query
19134+
description: Include deleted remote clusters
19135+
schema:
19136+
type: boolean
19137+
default: false
1913219138
responses:
1913319139
"200":
1913419140
description: Remote cluster info retrieval successful
@@ -21414,8 +21420,8 @@ paths:
2141421420
first_page_ascending:
2141521421
summary: First page, ascending order
2141621422
value:
21417-
cursor: ""
2141821423
channel_id: 4xp9fdt77pncbef59f4k1qe83o
21424+
cursor: ""
2141921425
per_page: 100
2142021426
subsequent_page:
2142121427
summary: Subsequent page using cursor
@@ -21427,16 +21433,16 @@ paths:
2142721433
summary: Query with time range starting from specific time
2142821434
value:
2142921435
channel_id: 4xp9fdt77pncbef59f4k1qe83o
21430-
cursor: ""
2143121436
start_time: 1635638400000
2143221437
per_page: 100
21438+
cursor: ""
2143321439
descending_order:
2143421440
summary: Descending order from recent
2143521441
value:
2143621442
channel_id: 4xp9fdt77pncbef59f4k1qe83o
2143721443
cursor: ""
21438-
per_page: 100
2143921444
sort_direction: desc
21445+
per_page: 100
2144021446
responses:
2144121447
"200":
2144221448
description: Posts retrieved successfully
@@ -23186,6 +23192,7 @@ paths:
2318623192
An enterprise advanced license is required.
2318723193
tags:
2318823194
- Content Flagging
23195+
operationId: GetCFFlagConfig
2318923196
responses:
2319023197
"200":
2319123198
description: Configuration retrieved successfully
@@ -23223,6 +23230,7 @@ paths:
2322323230
schema:
2322423231
type: string
2322523232
description: The ID of the team to retrieve the content flagging status for
23233+
operationId: GetCFTeamStatus
2322623234
responses:
2322723235
"200":
2322823236
description: Content flagging status retrieved successfully
@@ -23257,6 +23265,7 @@ paths:
2325723265
schema:
2325823266
type: string
2325923267
description: The ID of the post to be flagged
23268+
operationId: PostCFPostFlag
2326023269
requestBody:
2326123270
required: true
2326223271
content:
@@ -23295,6 +23304,7 @@ paths:
2329523304
An enterprise advanced license is required.
2329623305
tags:
2329723306
- Content Flagging
23307+
operationId: GetCFFields
2329823308
responses:
2329923309
"200":
2330023310
description: Custom fields retrieved successfully
@@ -23326,6 +23336,7 @@ paths:
2332623336
schema:
2332723337
type: string
2332823338
description: The ID of the post to retrieve property field values for
23339+
operationId: GetCFPostFieldValues
2332923340
responses:
2333023341
"200":
2333123342
description: Property field values retrieved successfully
@@ -23359,6 +23370,7 @@ paths:
2335923370
schema:
2336023371
type: string
2336123372
description: The ID of the post to retrieve
23373+
operationId: GetCFPost
2336223374
responses:
2336323375
"200":
2336423376
description: The flagged post is fetched correctly
@@ -23390,6 +23402,7 @@ paths:
2339023402
schema:
2339123403
type: string
2339223404
description: The ID of the post to be removed
23405+
operationId: RemoveCFPost
2339323406
responses:
2339423407
"200":
2339523408
description: Post removed successfully
@@ -23421,6 +23434,7 @@ paths:
2342123434
schema:
2342223435
type: string
2342323436
description: The ID of the post to be kept
23437+
operationId: KeepCFPost
2342423438
responses:
2342523439
"200":
2342623440
description: Post marked to be kept successfully
@@ -23444,6 +23458,7 @@ paths:
2344423458
Only system admins can access this endpoint.
2344523459
tags:
2344623460
- Content Flagging
23461+
operationId: GetCFConfig
2344723462
responses:
2344823463
"200":
2344923464
description: Configuration retrieved successfully
@@ -23464,6 +23479,7 @@ paths:
2346423479
Only system admins can access this endpoint.
2346523480
tags:
2346623481
- Content Flagging
23482+
operationId: UpdateCFConfig
2346723483
requestBody:
2346823484
required: true
2346923485
content:
@@ -23503,6 +23519,7 @@ paths:
2350323519
schema:
2350423520
type: string
2350523521
description: The search term to filter content reviewers by
23522+
operationId: SearchCFTeamReviewers
2350623523
responses:
2350723524
"200":
2350823525
description: Content reviewers retrieved successfully
@@ -23542,6 +23559,7 @@ paths:
2354223559
schema:
2354323560
type: string
2354423561
description: The ID of the user to be assigned as the content reviewer for the post
23562+
operationId: PostCFPostReviewer
2354523563
responses:
2354623564
"200":
2354723565
description: Content reviewer assigned successfully
@@ -26418,12 +26436,12 @@ components:
2641826436
description: Additional attributes for the property field (options for select fields, visibility, etc.).
2641926437
additionalProperties: true
2642026438
example:
26439+
visibility: when_set
26440+
sortOrder: 1
2642126441
options:
2642226442
- color: '#ff0000'
2642326443
id: opt1
2642426444
name: High
26425-
sortOrder: 1
26426-
visibility: when_set
2642726445
PropertyFieldPatch:
2642826446
type: object
2642926447
properties:
@@ -27054,8 +27072,8 @@ components:
2705427072
Attachments:
2705527073
type: array
2705627074
items:
27057-
$ref: '#/components/schemas/SlackAttachment'
27058-
SlackAttachment:
27075+
$ref: '#/components/schemas/MessageAttachment'
27076+
MessageAttachment:
2705927077
type: object
2706027078
properties:
2706127079
Id:
@@ -27081,7 +27099,7 @@ components:
2708127099
Fields:
2708227100
type: array
2708327101
items:
27084-
$ref: '#/components/schemas/SlackAttachmentField'
27102+
$ref: '#/components/schemas/MessageAttachmentField'
2708527103
ImageURL:
2708627104
type: string
2708727105
ThumbURL:
@@ -27091,9 +27109,9 @@ components:
2709127109
FooterIcon:
2709227110
type: string
2709327111
Timestamp:
27094-
description: The timestamp of the slack attachment, either type of string or integer
27112+
description: The timestamp of the message attachment, either type of string or integer
2709527113
type: string
27096-
SlackAttachmentField:
27114+
MessageAttachmentField:
2709727115
type: object
2709827116
properties:
2709927117
Title:

0 commit comments

Comments
 (0)