Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blocks key in README payload appears to be ignored #261

Open
4 of 10 tasks
jdangerx opened this issue Nov 30, 2023 · 3 comments
Open
4 of 10 tasks

blocks key in README payload appears to be ignored #261

jdangerx opened this issue Nov 30, 2023 · 3 comments
Labels
question Further information is requested

Comments

@jdangerx
Copy link

Description

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • example code related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

package version: v1.24.0

node version: ?

OS version(s): Github runner image ubuntu-22.04

Steps to reproduce:

  1. Modify the payload from the README to differentiate between the text content and the blocks content:
- name: test Slack Action
uses: slackapi/slack-github-action@v1.24.0
with:
  payload: |
    {
      "text": "Text: GitHub Action build result: ${{ job.status }}",
      "blocks": [
        {
          "type": "section",
          "text": {
            "type": "mrkdwn",
            "text": "Block: GitHub Action build result: ${{ job.status }}"
          }
        }
      ]
    }
env:
  SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
  1. Run the action

Expected result:

The message shows two lines, one starting with "Text: ..." and one starting with "Block: ..."

Actual result:

The message says "Text: ..." but not "Block: ..."

Attachments:

I tried just sending the "blocks" key without the "text" key and got

Error: no_text

Also, I found that in Block Kit Builder, the README payload results in an error while removing the text key makes it render appropriately. Maybe that's related?

@zimeg zimeg added the question Further information is requested label Nov 30, 2023
@zimeg
Copy link
Member

zimeg commented Nov 30, 2023

Hey @jdangerx! 👋 I think this is caused by a missing SLACK_WEBHOOK_TYPE value for the incoming webhook technique. Does adding that to the env cause the blocks text to appear?

@jdangerx
Copy link
Author

jdangerx commented Dec 1, 2023

Aha! Indeed, either setting SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK or using a SLACK_BOT_TOKEN instead works - thanks for the quick response! Do you think this warrants an update in README.md or was it just a case of me not reading closely enough 😅 ? I'm happy to make the docs change if you think that'd be helpful!

@zimeg
Copy link
Member

zimeg commented Dec 2, 2023

Sweet, glad to hear that! And you're totally right that this isn't clear in the README.md - feel free to make a change, it'd be really appreciated! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants