Join the conversation

Sign in to join this conversation, and others like it, in the communities you care about.

Wekan

Wekan is an open-source kanban board (Trello like) which allows a card-based task and to-do management.

Wekan / General

Webhooks to a custom api

Webhooks to a custom api

Wekan / General · January 21, 2020 at 5:32pm (Edited 4 years ago)

Basic questions: MY Use case

1 I load four boards each with seven list elements and the put three cards each in the left most list column of each board. I use default swimlane and no checklists and add members to each board as I go.

2) When I move any of the cards, I want to see that update remotely in my api

3) When I create the boards lists and cards, I add their ids that wekan creates to my databases so I know which item is which and where.

Question 1: If I go into the wekan hamburger menu in the gui and create a webhook (url, token, name,) it seems like I cannot select which actions or which cards or which boards are connected to that web hook. Does that mean that for each webhook I create that ANY user change in the wekan GUI fires a webhook with data about what moved and where? Can I create webhooks without using the GUI? (register a webhook via the api)?

Question 2:

This page - https://github.com/wekan/wekan/wiki/Webhook-data - seems to show the data sent back. Is this correct? would the section named MOVE apply in my usecase? Are there any other controls on what fires a webhook or what is contained in them? If so, I have ONE api endpoint in my application that receives all activities through one webhook, and whether I want to do anything with most of them or not, I get them all? And I choose to ignore most of the webhook bodies and only process the ones I care about?

Question 3: Do I even get webhooks back as I create boards, lists and cards through the api? Is that the best method for capturing the ids of the elements created (right now I capture the ids as I create the elements)?

Question 4: I do not understand bi-directional webhooks. Is there any more documentation on them? Do I assume that rather than use the api to populate the boards, lists, cards, I am able to register and track through a bidirectional webhook? If so it looks like the payloads I would get from a gui create or change would be the same as the payloads I would send to enact the same GUI create change from the remote program. Is that correct?

Question 5: What URL do I use to connect birectional webhooks (where do I send)? Do I authenticate the same way? How is the bidirectional webhook identified (url) as the target I am sending to (or do all web hooks I create in the gui just accept any command from any registered url?) Does only the token (auth) of the sending webhook determine whether in incoming webhook obeys the command or not? Do I get acknowledge or rejections replies back from the incoming webhook like I would with the incoming api?

As always thank you again Lauri for dealing with my long questions. :)

update: I see the webhook but only if the receiving api server online at aws. Trying to figure out how I do development with my systems behind my firewall. Was looking at smee. Any suggestions?

I also saw a post about "activities" https://github.com/wekan/wekan/pull/1199 which suggested I can be more selective with activities that trigger these hooks. Is that historical engineering or do I just not see the activities selection and if so where do I look.

Load previous messages

January 22, 2020 at 7:48pm

BY any chance... is the api endpoint set "integrations" how you assign webhooks to a board via the api?

    • reply
    • like

    if so then for each board I create a set of lists a set of board members and assign one or more integration?

      • reply
      • like

      sorry for the length of all of this but putting aside how well this might actually work, the nomenclature and protocol on what and why and how to do all of this is really not clear. Pretty sure most users do not care about apis and webhooks but for those that do a page that describes this would be helpful

        • reply
        • like

        I wish I knew that integrations was the terminology for webhooks, that its was assigned by board, was transitory to that new board

          • reply
          • like

          It kind of makes sense now, but approaching this anew was not expecting this.

            • reply
            • like

            thanks again

              • reply
              • like

              January 23, 2020 at 9:40am

              1 & 3 & 4 & 5) Global Webhooks / 2-way webhooks at Admin Panel info: https://github.com/wekan/wekan/pull/2665

              2) Limiting Webhook data https://github.com/wekan/wekan/issues/2830

              For receiving webhooks on local network, you could use some web form with PHP/Python/other backend, Google search for example code how to receive webhook,

              or NodeRED: https://github.com/wekan/wekan/issues/2017

              or Huginn or Flogo: https://github.com/wekan/wekan/issues/1160

              I added these links to wiki Webhooks section.

                like-fill
                1
                • reply
                • like

                webhooks are at database Integrations collection/table . REST API code is at wekan/models/* so if you need to add webhook to only one board, you could add new REST API code to wekan/models/*.

                  like-fill
                  1
                  • reply
                  • like

                  But if you just need webhooks for all boards, I would presume Global/2-way webhooks should work.

                    • reply
                    • like

                    When you receive those webhooks with your PHP/Python/other code then you can in that code decide per webhook message what to do with it, or discard it.

                      • reply
                      • like

                      January 23, 2020 at 9:31pm

                      Thank you Lauri, that helps

                        • reply
                        • like

                        January 27, 2020 at 2:39pm

                        Hello again on the subject of bidirectional traffic to a webhook. It still is clear as mud for me. I was expecting that I could send back move card commands back like I get them, ie a) I build boards, add members, add an integration, add several list items and then add cards through the api (perfectly working) b) when you move a card with eth GUI I get a move card integration (webhook) (again works great) and c) if I want to move a card on the GUI with the api I could just use the bidirectional web hook to just send the same sort of payload I got when I move the card in the GUI.

                          Edited
                          • reply
                          • like

                          Is that not how its works?

                            • reply
                            • like

                            I assume that was the bidirectional part which is why I was asking for a URL to hit.

                              • reply
                              • like

                              If not then bidirectional means what? That when I get a integration I can send back something only on the confirmation return trip? Meaning it is a return handshake not that I can hit the existing structure I already built with the api with a minor update. Please confirm, as this is not clear.

                                Edited
                                • reply
                                • like

                                If that is correct I would instead just use the api to edit card, in which case I use the existing boardid, listid and Card id in the path command line and the body just includes one thing, the new listid. Am I understanding this correctly? Is there a easier method that I am missing?

                                  • reply
                                  • like

                                  Thanks agaiin

                                    • reply
                                    • like

                                    January 27, 2020 at 9:49pm

                                    I don't know how it would be in any way bidirectional. Maybe read source of that pull request?

                                      • reply
                                      • like

                                      I have not coded it.

                                        • reply
                                        • like

                                        Wekan is full of code from many other contributors than me.

                                          • reply
                                          • like

                                          over 100 of contributors

                                            • reply
                                            • like