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

Question: Webhook Event on card-click/render #2518

Closed
jymcheong opened this issue Jun 28, 2019 · 19 comments
Closed

Question: Webhook Event on card-click/render #2518

jymcheong opened this issue Jun 28, 2019 · 19 comments

Comments

@jymcheong
Copy link

jymcheong commented Jun 28, 2019

Background

I manage to use Wekan as a means to triage "cases", which are basically alerts generated from some sensors as part of project that is going to be open-sourced.

I am using card activities (eg. card create, move..) to signal a backend to populate/modify the cards. Demo: https://www.youtube.com/watch?v=5_DsuOGkh2M

Use-Case

I intend to use Wekan in such a manner:

Questions

  • Where to modify such that I can generate a Webhook event for card-render/click?
  • Any other methods achieve the above use-case?

Thanks for this awesome Kanban!

Cheers,
Jym

@jymcheong jymcheong changed the title Question: Webhook on card-click/render Question: Webhook Event on card-click/render Jun 28, 2019
@xet7
Copy link
Member

xet7 commented Jun 28, 2019

@jymcheong

You can add Outgoing Webhooks to Wekan board at board hamburger menu / Cog settings icon at right side of members / Outgoing Webhooks.

It sends most board actions as this kind of JSON format as POST message to HTTP server, for example to Chat, Node-RED or other webserver, for example you could have PowerShell webserver receiving those messages and do some actions when something happens on board, like checkmarking checkbox. Some functionality could also be done with Excel and VBA.

Keep backups of your code, because if Windows Defender is enabled, it could have some heuristics that detects your code as malicious and deletes it. When I sometime installed Nim programming language to Win10, Windows Defender deleted it.

You could also add Javascript Clippy that would ask "It seems you are trying to exploit this computer, would you like help with that?"

@jymcheong
Copy link
Author

@xet7

Thanks for the heads up regarding Windows Defender!

I am already using Webhook with my nodejs Webhook-receiver, but Card events are only emitted for creation, deletion, move, archival & restore as per the documentation.

I can double check again if there are any Webhook event when I click on any Card (which will display card details & so on) but I believe there is none.

I need that event so that my existing Webhook-receiver can populate another list dynamically.

@xet7
Copy link
Member

xet7 commented Jun 28, 2019

Hmm, I think there is no such event yet at API for opening card:
https://wekan.github.io/api/

I'll check how to add it.

@jymcheong
Copy link
Author

jymcheong commented Jun 28, 2019 via email

@xet7
Copy link
Member

xet7 commented Jun 28, 2019

Hmm, I did not figure it out yet. Anyway, some pointers for your search:

  • you can use wekan/find.sh to search code, like ./find.sh isSelected and other words, like minicard, Activities, outgoing, js-open
  • at wekan/models/cards.js , wekan/models/activities.js , wekan/client/components/ could be some related code
  • you can search closed github pull requests for activities
  • for new activity, add translation in pull request only to wekan/i18n/en.i18n.json
  • see Wekan GitHub wiki for developer docs, directory structure etc.
  • look minicard with webbrowser right click/Inspect, what it triggers

@jymcheong
Copy link
Author

@xet7 Thanks, appreciate it. Will try those.

@jymcheong
Copy link
Author

https://stackoverflow.com/questions/15875128/how-to-tell-when-a-dynamically-created-element-has-rendered

Within the link, there's a MutationObserver thread... in the context of Wekan, when a mini-card is clicked, the full Card details are rendered (ie. dynamically added) into the interface, which can be "observed" & further process for custom use-cases.

@jymcheong
Copy link
Author

@xet7

I tried adding html codes via layout,

Screenshot 2019-07-01 09 41 16

It seems nothing happen. I used browser developer view to try to locate the stuff I included, can't seem to find it.

@xet7
Copy link
Member

xet7 commented Jul 1, 2019

Yes, it does not work yet.

@xet7 xet7 reopened this Jul 1, 2019
@jymcheong
Copy link
Author

jymcheong commented Jul 11, 2019

@xet7 if in the event we are keen to pay for this modification (sending out a Webhook when CardDetails is rendered), what amount of fees are we looking at?

Rgds,
Jym

@jymcheong
Copy link
Author

@xet7 Thanks. Let me check with my partners. Will get back soon.

@jymcheong
Copy link
Author

Implemented: jymcheong@843478a

@xet7 xet7 reopened this Aug 14, 2019
@xet7
Copy link
Member

xet7 commented Aug 14, 2019

@jymcheong

When I tried your code, and open card, there is Outgoing Webhook message [email protected] CardSelected. Are you planning on adding more card details to webhook message? And making this optional?

xet7 added a commit that referenced this issue Aug 14, 2019
@xet7
Copy link
Member

xet7 commented Aug 14, 2019

Anyway, this feature is now in Wekan, and anyone can add features to it with pull request.

@xet7 xet7 closed this as completed Aug 14, 2019
@jymcheong
Copy link
Author

@jymcheong

When I tried your code, and open card, there is Outgoing Webhook message [email protected] CardSelected. Are you planning on adding more card details to webhook message? And making this optional?

Not adding more card details.

@jymcheong
Copy link
Author

Anyway, this feature is now in Wekan, and anyone can add features to it with pull request.

Noted the PR. Didn't do a PR because I thought it was a rather 'niche' need. Thanks for adding the feature in.

@e-stoniauk
Copy link

@jymcheong

400 euro.
https://www.bountysource.com/issues/76172131-question-webhook-event-on-card-click-render
https://wekan.team/bounties/index.html

Hah, this is now built-in and we have it, too. Trying to figure out how to still get a notification on when new card created, moved, commented etc. But want to get rid of the webhook notification of the CardSelected. Any idea how to do that?

@jymcheong
Copy link
Author

jymcheong commented Dec 23, 2019

@jymcheong
400 euro.
https://www.bountysource.com/issues/76172131-question-webhook-event-on-card-click-render
https://wekan.team/bounties/index.html

Hah, this is now built-in and we have it, too. Trying to figure out how to still get a notification on when new card created, moved, commented etc. But want to get rid of the webhook notification of the CardSelected. Any idea how to do that?

By default, CARD_OPENED_WEBHOOK_ENABLED is set to false.

From issue #2666, it was mentioned that "docker image v3.35 but found same problem in older versions (since v3.18 I think)."

I tested v3.49 (without Docker) then, the environment variable CARD_OPENED_WEBHOOK_ENABLED = false ensures CardSelected events are not emitted.

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

No branches or pull requests

3 participants