vernemq / vmq-docs

VerneMQ Documentation Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webhook name in the vmq-admin webhook/show GET API response

narioinc opened this issue · comments

Hi Team,

First, I would like to like to share my humble appreciation to the vernemq team for putting together such a wonderful project and bringing enterprise grade mqtt broker to the masses.

I am currently working on a totally open source version of a vernemq admin UI app here:
https://github.com/narioinc/vmqadmin-ui ( took this up as a fun work during quarantine :) )

One of the features that I am trying to integrate is registering webhooks either runtime (vmq-admin) or persistent (allowing permanent addition to vernemq.conf)

While approaching this feature I found there to a small issue that I though the team could enhance in the vmqadmin-api.

ISSUE
When I allow the editing of the vernmq.conf file in my UI app, the conf file expects a webhook name when declaring the webhook. for e.g. vmq_webhooks.mywebhook1.hook
However when vmqadmin returns a list of webhooks, it does so without specifying the name of the webhooks in the response, and now if this GET request is used to create a page in angular/react, I don't have an idea which webhook params belongs to which weebhook name and hence operation like editing, deleting webhooks becomes ambiguous

For example
if vernemq.conf file has two webhooks like this

vmq_webhooks.mywebhook1.hook=on_publish
vmq_webhooks.mywebhook1.endpoint=http://localhost:7777/webhooks/test1
vmq_webhooks.mywebhook2.hook=on_auth_m5
vmq_webhooks.mywebhook2.endpoint=http://localhost12

then the vmqadmin REST api give back this

({
    "table": [
        {
            "hook": "on_publish",
            "endpoint": "http://localhost:7777/webhooks/test1",
            "base64payload": true,
            "response_timeout": 5000
        },
        {
            "hook": "on_publish",
            "endpoint": "http://localhost:7777/webhooks/test2",
            "base64payload": true,
            "response_timeout": 5000
        }
    ],
    "type": "table"
})

Now because I don't know which webhook name these configs are present against, other CRUD operation get affected.

I can handle this association outside of the vmqadmin API (by storing it in the sq-lite db i hold in my app) but I was thinking that can the vmq-admin API also return the webhook name as stored in the conf file if possible

sorry, opened in wrong repo

Awesome initiative @narioinc, makes sense what you mention. Can you please open a ticket on the main VerneMQ repo https://github.com/vernemq/vernemq. Thanks!

hi @codeadict ,thanks for your kind words. The project has a long way as I have many features to expose in the UI :)

I opened an issue and have closed it based on @ioolkos suggestion of using the url as a key for resolving the ambiguity.
#1507 was the issue and is now closed. In the long term, the webhook name in the response will add a lot of context for the API consumer in terms consistency in data being configured and what the api returns back in /webhooks/show api.