Closed datenwort closed 7 years ago
So I was blind. Found the .../timelineNotes/
API. But is there a way to implement a hook?
What hook do you mean? Do you have an example?
Outgoing webhooks are mostly used to react on something. In Wekan for example a notification is send via this webhook if a card is changed, moved or something else. The listener then can analyse the change and react (e.g. refresh the burn down chart, adding a new requirement to the requirements document). In Slack is also a possibility to use this.
Reason is for example to react on communication with a users (e.g. bots) or in a room. So you send a note in a room and the listener (bot, ai) analyse the text and react on it (e.g. send back an answer)
Hope this was understandable.
There is a hook which allows you do something after a note was created or updated, but it's a bit more low-level (and because of this more powerful đ ) than in your examples. What you have to do is something like this:
process
method to decide whether you want to react on the creation or update of the provided note and for instance check the content for some trigger words, look for mentioned users or maybe check that the topic (aka blog or room) has a certain title. If the note should be handled return true
.process
method returns true, the method processAsynchronously
will be called and allows you to do whatever you like. To send an HTTP request to some URL you can use the HttpClient library which is bundled in Communote.processAsynchronously
method is only passed an ID of the note, you can use the getNote(Long noteId, Converter<Note, T> converter)
method of the NoteService to resolve the ID and get the data you want. With the help of the ServiceLocator you can get a reference of the NoteService like this: ServiceLocator.findService(NoteService.class)
NoteStoringPostProcessor
interface is registered automatically to Communote when you deploy the plugin, you will have to add the following 3 annotations to the class:
If you have further questions don't hesitate to ask đ
Thanks for this very detailed information. I will do my best to implement it.
Hi,
I tried to add an external communication channel which should listen to the content on a specific topic. Maybe I am blind but I cannot find an introduction how to get the content of a topic? Is therer currently a possibility?