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: ✨ add webhook #691

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

HannesOberreiter
Copy link
Contributor

@HannesOberreiter HannesOberreiter commented Apr 8, 2024

This pull request introduces the ability to configure a global webhook URL. This allows notifications to be sent to a destination of your choice, in addition to Slack.

Why a global webhook? A global webhook would allow easily to integrate other in-house and more solutions without the need to wait for features arrive in plankaban.

# WEBHOOK_URL=
# WEBHOOK_BEARER_TOKEN=(optional)

To support this feature, I've refactored the existing Slack message utility to be more versatile and handle message generation internally.

Additional Changes:

  • Potential Bug Fix: In comment-actions/delete.js, there's a call to actions.deleteOne which might be unintended. I've left it for review.
  • Notification Refactoring: The notification for card deletion has been moved to a more appropriate location.
  • Added new action if a comment or card is deleted.

Testing Note:

I wasn't able to test the Slack integration changes myself as I don't have Slack installed. However, I reviewed the official Slack documentation and identified some discrepancies between the current implementation and the official docs. Further review and testing are needed! Did send wrong encoding and moved to JSON which seems simpler, now it works (https://api.slack.com/web#posting_json).

Improvements:

Add more actions to the global webhook, eg. user created, boards etc.

Possible related issues: #656, #215

@CLAassistant
Copy link

CLAassistant commented Apr 8, 2024

CLA assistant check
All committers have signed the CLA.

@meltyshev
Copy link
Member

meltyshev commented Apr 8, 2024

Hi! Thanks for working on this 🙏 I'll try to test it as soon as I have some time.

I have a few thoughts about how to extend webhook types with this approach. Probably the main problem is that the Action is exactly what is displayed at the bottom of the card and it seems wrong if we add for example DELETE_CARD or DELETE_COMMENT_CARD there, but on the other hand we can make the cardId field optional, add boardId and then it would be ok, as we can store and display board actions (not just for a card). But then, for example, if we want to add a webhook when user data changes, we can no longer use Action here (as there are no relationships to a board or card)... So, the question is about the possibility to extend it for any action (but I certainly don't think it's all needed right away).

UPD: it seems like it should be some kind of separate model (maybe just a virtual one, without saving to DB) where we can define all types of possible actions in Planka and use that for webhooks and other notifications, but there may be a problem that each notification data is too different and needed different related data as parameters.

@HannesOberreiter
Copy link
Contributor Author

HannesOberreiter commented Apr 9, 2024

Probably the main problem is that the Action is exactly what is displayed at the bottom of the card

Make sense, my bad, I though its more like a global action log (which would also make sense to have an endpoint for global action logs if one want to create plugins for combined logs etc). We could simplify the sendMessage function by accepting a custom sendMessage.type, along with specific details like user, card, and board. Integrating this functionality into existing CRUD operations within controllers shouldn't be an issue.

As for the global webhook it would make sense to push all information forward as it can anyway be filtered by one self.

Perhaps, splitting again global and platform-specific messaging (like Slack, Google) would be more practical. Ultimately, the ideal solution in my opinion for platform-specific messenger would allow configuration of messaging options per board from admins and through the dashboard.

Cheers
Hannes

@orcunbaslak
Copy link

We use "Discord" for our company. We could also benefit from this is Slack/Discord implementation is the same. Thank you.

@HannesOberreiter
Copy link
Contributor Author

HannesOberreiter commented May 10, 2024

@meltyshev should I invest any time in this rewrite or will the logic be superseded by v2 of planka?

If I rewrite it, I would need an outline from you how you want it to look like.

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

Successfully merging this pull request may close these issues.

None yet

4 participants