-
-
Notifications
You must be signed in to change notification settings - Fork 728
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: trim messages longer than 3000 chars (#8219)
## About the changes When trying to send messages longer than 3000 chars we get this error: ``` [ERROR] web-api:WebClient:0 failed to match all allowed schemas [json-pointer:/blocks/0/text] [ERROR] web-api:WebClient:0 must be less than 3001 characters [json-pointer:/blocks/0/text/text] [2024-09-23T10:10:15.676] [WARN] addon/slack-app - All (1) Slack client calls failed with the following errors: A platform error occurred: {"ok":false,"error":"invalid_blocks","errors":["failed to match all allowed schemas [json-pointer:/blocks/0/text]","must be less than 3001 characters [json-pointer:/blocks/0/text/text]"],"response_metadata":{"messages":["[ERROR] failed to match all allowed schemas [json-pointer:/blocks/0/text]","[ERROR] must be less than 3001 characters [json-pointer:/blocks/0/text/text]"],"scopes":["incoming-webhook","users:read","channels:read","groups:read","mpim:read","im:read","users:read.email","chat:write"],"acceptedScopes":["chat:write"]}} ``` This PR trims the text length to 3000 chars. We also upgrade slack API due to some security fixes: https://github.com/slackapi/node-slack-sdk/releases/tag/%40slack%2Fweb-api%407.3.4 After checking the migration guide to v7 it seems that none of the breaking changes affect us: https://github.com/slackapi/node-slack-sdk/wiki/Migration-Guide-for-web%E2%80%90api-v7 ## Testing I did manual test this integration and the fix. The way to reproduce is adding a very long strategy name and sending that as an update on Slack: ![image](https://github.com/user-attachments/assets/81df9554-f59b-4fa4-96c8-77dbf7a56257) Now the event succeeds and we notice on the integration event log that the message was trimmed: ![image](https://github.com/user-attachments/assets/79efc536-3dd3-4090-99f3-5fd4c7a88715) --------- Co-authored-by: Nuno Góis <[email protected]>
- Loading branch information
1 parent
7b686ed
commit 7d916e9
Showing
4 changed files
with
46 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters