The pipe "slack-notify" fails for large messages

Steve Annett June 19, 2023


In my Bitbucket pipeline I have a slack notify pipeline:

          - pipe: atlassian/slack-notify:2.0.1
            variables:
              WEBHOOK_URL: $SLACK_RELEASE_NOTES_WEBHOOK_URL
              PRETEXT: $TITLE
              MESSAGE: $MESSAGE


It works well for small messages, but if MESSAGE is large, for example the length of the Declaration of Independence the pipeline will fail with the error:


Notification failed. Pipe has finished with an error: 400 Client Error: Bad Request for url: $SLACK_RELEASE_NOTES_WEBHOOK_URL

 

This pipeline is for posting auto-generated release notes, and occasionally I require long release notes. How do I get around this issue?

1 answer

1 accepted

1 vote
Answer accepted
Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 23, 2023

@Steve Annett hi. Thanks for your question.
According to docs:
The text for the block. This field accepts any of the standard text formatting markup when type is mrkdwn. The minimum length is 1 and maximum length is 3000 characters.

So this is a Slack API limit.

Regards, Igor

Steve Annett June 23, 2023

Thanks for answering Igor.

So presumably if I switch to using the Slack Block Kit, I could have 50 blocks and give 3000 characters to each block?

Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 23, 2023

I don't know, but you could check this case without pipe usage with just sending post requests.

Steve Annett July 7, 2023

I can confirm that by using a custom payload created with Slack Block Kit and each section of test does not exceed 3000, I can get around the size limit

 - pipe: atlassian/slack-notify:2.0.1
variables:
WEBHOOK_URL: $SLACK_RELEASE_NOTES_WEBHOOK_URL
MESSAGE: " "
PAYLOAD_FILE: payload.json
Like Igor Stoyanov likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events