Closed3

Slack API Posting Messages における上限

chima91chima91

公式ドキュメント

https://api.slack.com/apis/rate-limits#rtm-posting-messages

The message server will disconnect any client that sends a message longer than 16 kilobytes. This includes all parts of the message, including JSON syntax, not just the message text. Clients should limit messages sent to channels to 4000 characters, which will always be under 16k bytes even with a message comprised solely of non-BMP Unicode characters at 4 bytes each. If the message is longer a client should prompt to split the message into multiple messages, create a snippet or create a post.

メッセージサーバーは、16kb 以上のメッセージを送信したクライアントを切断する。これにはただのテキストだけでなく、JSON構文を含むメッセージのすべての部分が含まれ、クライアントは送信されるメッセージを4000文字に制限する必要がある。これで、BMP 以外の Unicode 文字のみで構成されたメッセージであっても、常に 16kb 以下になる。メッセージが長い場合、複数のメッセージに分割したりスニペットを作成したりする必要がある。

chima91chima91

テスト

もともと、通知メッセージの大部分を占める文章が2,500文字だと通知は来ていたが、それを3,000文字にしてみると通知が来なくなった。
そのため、2,500文字を超える部分は切り捨てるようにしたら、5,000文字の文章を投稿しても無事に Slack 通知が来るようになった。

このスクラップは12日前にクローズされました