mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: expose Markdown fields in webhook payload (#14931)
Fixes: https://github.com/coder/coder/issues/14930
This commit is contained in:
@@ -90,9 +90,11 @@ receiver.router.post("/v1/webhook", async (req, res) => {
|
||||
return res.status(400).send("Error: request body is missing");
|
||||
}
|
||||
|
||||
const { title, body } = req.body;
|
||||
if (!title || !body) {
|
||||
return res.status(400).send('Error: missing fields: "title", or "body"');
|
||||
const { title_markdown, body_markdown } = req.body;
|
||||
if (!title_markdown || !body_markdown) {
|
||||
return res
|
||||
.status(400)
|
||||
.send('Error: missing fields: "title_markdown", or "body_markdown"');
|
||||
}
|
||||
|
||||
const payload = req.body.payload;
|
||||
@@ -118,11 +120,11 @@ receiver.router.post("/v1/webhook", async (req, res) => {
|
||||
blocks: [
|
||||
{
|
||||
type: "header",
|
||||
text: { type: "plain_text", text: title },
|
||||
text: { type: "mrkdwn", text: title_markdown },
|
||||
},
|
||||
{
|
||||
type: "section",
|
||||
text: { type: "mrkdwn", text: body },
|
||||
text: { type: "mrkdwn", text: body_markdown },
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -67,10 +67,10 @@ The process of setting up a Teams workflow consists of three key steps:
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"title_markdown": {
|
||||
"type": "string"
|
||||
},
|
||||
"body": {
|
||||
"body_markdown": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@@ -108,11 +108,11 @@ The process of setting up a Teams workflow consists of three key steps:
|
||||
},
|
||||
{
|
||||
"type": "TextBlock",
|
||||
"text": "**@{replace(body('Parse_JSON')?['title'], '"', '\"')}**"
|
||||
"text": "**@{replace(body('Parse_JSON')?['title_markdown'], '"', '\"')}**"
|
||||
},
|
||||
{
|
||||
"type": "TextBlock",
|
||||
"text": "@{replace(body('Parse_JSON')?['body'], '"', '\"')}",
|
||||
"text": "@{replace(body('Parse_JSON')?['body_markdown'], '"', '\"')}",
|
||||
"wrap": true
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user