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

feat(message): support multiple channel IDs #126

Merged
merged 6 commits into from
Sep 13, 2022
Merged

feat(message): support multiple channel IDs #126

merged 6 commits into from
Sep 13, 2022

Conversation

treemmett
Copy link
Contributor

@treemmett treemmett commented Sep 13, 2022

Summary

Adds support for comma-separated channel ID's.

Closes #118

Requirements (place an x in each [ ])

@CLAassistant
Copy link

CLAassistant commented Sep 13, 2022

CLA assistant check
All committers have signed the CLA.

README.md Outdated
@@ -124,6 +124,22 @@ Using JSON payload for constructing a message is also available:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
```

Multiple channels can be sent the same message by providing a comma-separated list of ID's:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thoughts on how to reword this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would actually remove this additional section and just add a comment in the specific "Usage" sections above where applicable. E.g. line 90-92 above I would add an extra line of comment that is like:

# You can pass in multiple channels to post to by providing a comma-delimited list of channel IDs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good suggestion @filmaj! ➕

Copy link
Contributor

@filmaj filmaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the PR @treemmett !

I left a couple of comments, one suggestion on how to integrate the new feature you are adding support for in the README and another one regarding test organization.

Going to approve the github action execution - feel free to at-mention me directly if you'd like for me to take another look!

README.md Outdated
@@ -124,6 +124,22 @@ Using JSON payload for constructing a message is also available:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
```

Multiple channels can be sent the same message by providing a comma-separated list of ID's:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would actually remove this additional section and just add a comment in the specific "Usage" sections above where applicable. E.g. line 90-92 above I would add an extra line of comment that is like:

# You can pass in multiple channels to post to by providing a comma-delimited list of channel IDs.

// update message
webResponse = await web.chat.update({ ts, channel: channelId, text: message, ...(payload || {}) });
} else {
webResponse = await web.chat.update({ ts, channel: channelId.trim(), text: message, ...(payload || {}) });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, good call to trim it here.

@@ -56,16 +56,19 @@ describe('slack-send', () => {
describe('happy path', () => {
it('should send a message using the postMessage API', async () => {
fakeCore.getInput.withArgs('slack-message').returns('who let the dogs out?');
fakeCore.getInput.withArgs('channel-id').returns('C123456');
fakeCore.getInput.withArgs('channel-id').returns('C123456,C987654');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the test! Could we actually split this test case up into two test cases? Ideally I'd like separate tests for the single-channel and multi-channel scenarios.

@filmaj filmaj self-assigned this Sep 13, 2022
@filmaj filmaj added the enhancement New feature or request label Sep 13, 2022
@filmaj filmaj added this to the 1.22 milestone Sep 13, 2022
Copy link
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beauty, thanks for the contribution @treemmett!

README.md Outdated
@@ -124,6 +124,22 @@ Using JSON payload for constructing a message is also available:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
```

Multiple channels can be sent the same message by providing a comma-separated list of ID's:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good suggestion @filmaj! ➕

@treemmett
Copy link
Contributor Author

@filmaj Thanks for the suggestions! They've been implemented and pushed.

Copy link
Contributor

@filmaj filmaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks a ton for putting this together. Gonna let the tests run then will merge in!

@filmaj filmaj merged commit 4707dbc into slackapi:main Sep 13, 2022
@amirkarimi
Copy link

@treemmett Thanks for implementing this feature. We're trying to update the messages sent to multiple channels and we get Error: Error: An API error occurred: message_not_found. It updates the message in one channel but not in the other one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support multiple channel IDs
5 participants