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

Clarify about chat.update only work with channels and not DMs #395

Open
nahuelhds opened this issue Feb 1, 2025 · 1 comment
Open

Clarify about chat.update only work with channels and not DMs #395

nahuelhds opened this issue Feb 1, 2025 · 1 comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Milestone

Comments

@nahuelhds
Copy link

Hi! Was trying the example for updating a message and two things that happened.

The action succeed but no update happen. First of all, the action itself was failing, actually with message_not_found error but the action reports success anyway.

See the following image
Image

You can see the last three lines

##[debug]Set output response = {"ok":false,"error":"message_not_found","response_metadata":{"scopes":["incoming-webhook","chat:write"],"acceptedScopes":["chat:write"]}}
##[debug]Set output time = 1738447171
##[debug]Finishing: Update the original message with success

Ok = False, but "Update the original message with sucess" (?

Doing some more research, I learned that my issue was that I was trying to post to a private message and this only works with channels. I'd be nice to warn about this in the docs :)

@zimeg zimeg added question Further information is requested documentation Improvements or additions to documentation labels Feb 3, 2025
@zimeg zimeg added this to the 2.x milestone Feb 3, 2025
@zimeg
Copy link
Member

zimeg commented Feb 3, 2025

Hey @nahuelhds 👋 Thanks for sharing the details of your investigation into this! 🔍

The failure mode of this action defaults to silent API errors which can be toggled on to cause errors from the Slack API to exit the step with an error:

  - uses: slackapi/[email protected]
    with:
+     errors: true

This can certainly create confusing cases like what you're finding, but this default was picked to avoid breaking an entire CI pipeline if, perhaps, posting a "completion" message was to fail as the very last step due to a server outage or similar.

Updating a message using a user ID with chat.update also isn't supported, as you've noted. I agree this isn't a nice edge to discover... However, the conversation ID of the DM can be used here instead! This will start with a "D":

  - uses: slackapi/[email protected]
    with:
      method: chat.update
      token: ${{ secrets.SLACK_BOT_TOKEN }}
      payload: |
+       channel: D0123456789
        ts: "${{ steps.launch_sequence.outputs.ts }}"
        text: "Deployment finished! :rocket:"

Setting errors to true might be helpful when debugging, but I'm hoping the updated conversation ID helps with these message updates - please let me know in whichever case or if other questions arise 🙏 ✨

I'll share a note about the allowed conversation types with our documentation team since I'm hoping the Slack API reference can serve as a source of truth for accepted arguments 📚

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

No branches or pull requests

2 participants