Excerpt |
---|
Messages are sent to the Slack API |
...
as JSON objects. The Slack message format is defined in |
...
...
. |
...
You can test advanced message formatting with the |
...
Slack Message Builder |
...
before bringing your message into the Slack Connector |
...
add-on and configuring your template keys. Advanced TemplatingThe JSoft Slack Connectors use the StringTemplate library to integrate data from your Atlassian application into Slack message objects. Please see the StringTemplate Cheat Sheet for an introduction to this syntax and the various features it provides. Each message has a variety of attributes provided to it by the Slack Connector that can be easily accessed with StringTemplate syntax. Additionally, some StringTemplate attributes may be entire Java objects whose properties can be traversed with the StringTemplate syntax to extract exactly the data you need. |
Please see the documentation for your connector to find exactly what template attributes are available:
- Slack connector for JIRA server
- Slack connector for JIRA Cloud
- Slack connector for Bitbucket Server
- Slack connector for Confluence Server
Default Message Template
Code Block | ||
---|---|---|
| ||
{ "text":"<eventType> in <spaceLink> by <userLink>", "attachments": [ { "color": "#205081", "title": "<contentTitle>", "title_link": "<contentLink>", "text": "<contentBody>" } ] } |
...
Key | Description | Sample data |
---|---|---|
<spaceLink> | a link of Confluence space | http://localhost:1990/confluence/display/TEST |
<spaceKey> <space.key> | a space key | TEST |
<contentTitle> | a page, blogpost title, task, question | This is demo page |
<contentLink> | a link of page , blog, task, question | http://localhost:1990/confluence/display/TEST/This+is+demo+page?focusedCommentId=884788#comment-884788 |
<contentBody> | an excerpt of page,blog,task,comment | This is demo content page |
<contentBody; format="substring_2"> <contentBody; format="substring_2_4"> | Use substring function to get string from index 2 to length Use substring function to get string from index 2 to 4 (if string length <4 , it will get length) | |
<if(isNewPage)>is new page<endif> | Conditional <if><else><endif> which only works with booleanExpression | <if(isNewPage>New Page <else> updated Page<endif> <if(isNewBlogpost>New Blogpost <else> updated Blogpost<endif> <if(isNewComment>New comment <else> updated comment<endif> |
<userLink> | an user link | http://localhost:1990/confluence/display/~admin |
<userName> | an username | admin |
<eventType> | a context of current content | eventType= "New page has created in Space" |
<event> | An event code | EventType_CreatedPage |
<page> | If you are working on a page | https://docs.atlassian.com/confluence/5.9.7/com/atlassian/confluence/pages/Page.html |
<blogpost> | A blogpost object | https://docs.atlassian.com/confluence/5.9.7/com/atlassian/confluence/pages/BlogPost.html |
<space> | A space object | https://docs.atlassian.com/confluence/5.9.7/com/atlassian/confluence/spaces/Space.html |
<comment> | A comment object | https://docs.atlassian.com/confluence/5.9.7/com/atlassian/confluence/pages/Comment.html |
<question> | A question object | https://docs.atlassian.com/confluence/5.9.7/com/atlassian/confluence/content/CustomContentEntityObject.html |
<answer> | A answer object | https://docs.atlassian.com/confluence/5.9.7/com/atlassian/confluence/content/CustomContentEntityObject.html |
<task> | A task object | https://docs.atlassian.com/confluence/5.9.7/com/atlassian/confluence/core/ContentEntityObject.html |
Advanced Template Keys and Formatting
...