slacklog-generator
slacklog-generator copied to clipboard
blocks の内容が取れていない
slack-go が用意している構造体が Slack API が返す構造とマッチしていないため、blocks の内容がほぼ丸ごと何も JSON として保存されていない。
最終的に正確にレンダリングするためには blocks の内容は必須
実際のレスポンス: (発言の内容は重要ではないので差し替えてあります)
{
"client_msg_id": "45da996d-45af-4ea9-938e-31dc7ffc61f9",
"type": "message",
"text": "ほげ",
"user": "U776661HA",
"ts": "1594114388.335900",
"team": "T03C4RC8V",
"blocks": [
{
"type": "rich_text",
"block_id": "0Rh",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "ほげ"
}
]
}
]
}
]
}
JSON として保存されたメッセージ
{
"client_msg_id": "45da996d-45af-4ea9-938e-31dc7ffc61f9",
"type": "message",
"user": "U776661HA",
"text": "ほげ",
"ts": "1594114388.335900",
"team": "T03C4RC8V",
"replace_original": false,
"delete_original": false,
"blocks": [
{
"type": "rich_text",
"block_id": "0Rh"
}
],
"source_team": "T03C4RC8V",
"user_team": "T03C4RC8V"
}
elements 以下がゴソッとないです。構造体にもメンバーがないです。
雑な調査メモ
何やら1年半ほど前のもので、この辺りに変更が入ると言う内容の記事を見つけました。
https://api.slack.com/changelog/2019-09-what-they-see-is-what-you-get-and-more-and-less
blocks に関するリファレンスはおそらく以下のページなのですが、 type=rich_text なるものは載っていません… Slack 仕事しろ…。
https://api.slack.com/reference/block-kit/blocks