0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[Slack bolt] bolt-app The top-level `text` argument is missing in the request payload for a chat.postMessage call という警告の対処法

0
Last updated at Posted at 2023-11-05

結論

chat.*のメソッド内のパラメータをblocksともう一つfallbackとして付け加える

警告が出るコード例

・ ・ ・
app.event("reaction_added", async ({ event, say, client }) => {
    // 何かしらの処理
    
    await say({
        blocks: [
            ・ ・ ・
            // 処理
        ],
    })

    // 何かしらの処理
})
・ ・ ・

警告が出ないコード例

・ ・ ・
app.event("reaction_added", async ({ event, say, client }) => {
    // 何かしらの処理
    
    await say({
        blocks: [
            ・ ・ ・
            // 処理
        ],
        text: 'This is fallback example.' // 追記
    })

    // 何かしらの処理
})
・ ・ ・

このようにfallbackとして、blocks以外のパラメータ(今回で言うとtext)を付け加える必要がある。

なぜこのような処置が必要なのか

目的がfallbackなので、もしblocks内の処理がうまくいかなかったときも安全に処理を継続させるためだと勝手に思ってます。

参考

https://github.com/slackapi/bolt-js/issues/1249

最後に

めっちゃ関係ないんですけど、最近お菓子のダースが美味しくなってないですか?
最近久しぶりに食べてびっくりしちゃいました

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?