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

Add Slack Share Update Trigger #21

Closed

Conversation

stevysmith
Copy link
Contributor

Slack Share Update, three triggers:

  • When joining a room, ping a message out on Slack setting the topic of conversation (or asking to Pair)
  • When leaving a room, ping a message out on Slack with a summary of what you talked about and any follow-up
  • When finishing a call, ping a message out on Slack with a summary of what you talked about and any follow-up

All messages are optional, messages can be previewed before sending

Copy link

github-actions bot commented Nov 3, 2023

Thanks for your contribution, @stevysmith! 🎉

We've done some automated sense checks on your trigger, slack-share-update. All looks great! Someone from Tuple will now manually review your trigger's code and get back to you.

@stevysmith
Copy link
Contributor Author

@mcmillan was this a bit too OTT for a single trigger do you think 😁? I can make them individual maybe?

@mcmillan
Copy link
Member

mcmillan commented Dec 1, 2023

@stevysmith Not necessarily OTT at all! The thing that makes me a bit wary of approving this is the JSON escaping logic – right now we're doing that using sed:

ESCAPED_MESSAGE=$(echo "$FULL_MESSAGE" | sed 's/"/\\"/g; s/\\/\\\\/g; s/\//\\\//g; s/`/\\`/g')

This feels a little precarious to me and could perhaps be misused by a bad actor. I think there's a few options for getting around this:

  1. Shell out to something like jq:
    • You could build a "safe" JSON string via jq -n --arg full_message $FULL_MESSAGE '{"message": $full_message}'
    • This would require users of the script to install jq, e.g. via brew install jq on macOS – you should include this in the hook's README
  2. Use a higher-level language (e.g. Ruby / Python)
    • Bash is inherently a bit of a pig – using something like Ruby or Python would make it a lot easier to reuse functionality between your various hooks and solve the JSON escaping problem
    • I'm happy to help port your hooks if needs be!

More generally, I reckon this trigger is very specific to your workflow – if we could separate it out into a few different triggers to make it more generally useful, that'd be ace, but if not let's get it it in as-is!

@stevysmith
Copy link
Contributor Author

Thanks! After some use it does get a bit intense with all three being active. It might be better with them separated out and then people can pick and choose.

I'll rework it..

@mcmillan mcmillan closed this Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants