text objectのtypeをmrkdwn
にすることで、リッチな表現が可能になります。
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "_italic_\n*bold*\n~strikethrough~"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "通常のテキスト\n>引用のテキスト\n>`インラインコード`\n```複数行のコード\n複数行のコード\n複数行のコード```"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "- リスト1\n- リスト2\n- リスト3",
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "https://www.google.com/\n<https://www.google.com/|Google>\nMention to <@[MemberID]>",
}
}
]
}
上記では、以下を順に記載しています。
以下のコマンドで、フォーマット化されたメッセージが確認できます。
curl -X POST -H 'Content-type: application/json' --data '[上記のJSONデータ]' https://hooks.slack.com/services/[各アプリ固有の値]
©Omori
MEOW!