Ok, so I’ve code my little forge app for search that contacts a server of my choice to generate results.
It currently resides/displays standalone in the feed to the right of the web display.
Is there any way I can “intercept” search related events? I would like to kick off a call to my server when a user types in a query in the standard search widget (to the left of the magnifying glass icon)? Also, is there any way to “inject” search results into the standard display?
Think of a user typing in a query, which by default would search the content of a cloud instance. This is sent in parallel, for example, to Wikipedia, which returns a list of (external) results. This list should be displayed with the results from the regular content search.
Here is some progress I made.
Generally following these steps I added the trigger module to my app. It captures events like “avi:confluence:viewed:page”. The list of events is available here. My app simply logs messages to the console, so I see page_viewed events and such in my forge tunnel.
However, the one event I would really be interested in would be the Forge variant of “search_performed” which is mentioned in the list of WebHooks for Connect-style apps.
I tried “avi:confluence:search:performed” but that doesn’t seem to exist, or maybe it requires permissions I don’t know about.
Any help here?
P.S.: the scope
search:confluence doesn’t do the trick…
More progress, maybe.
In order to verify if the event “search_performed” still exist, hack up a mini-Connect-App that logs this event. The prototype (c++ guy, don’t know if that’s what they’re called in js…) of the route called looks like this:
app.post(‘/search_performed’, addon.authenticate(), function (req, res)
In the request req, I can see the term the user wants to search for, so the first part of my question could be resolved using the Connect app approach. It is even possible to intercept partial queries while the user is typing.
However, I don’t see how to interpret the response res, couldn’t find any documentation on it. Specifically, none of the search results shown in the dropdown/result display can easily be identified (maybe they’re behind some promise that’s not fulfilled yet?).
Any ideas, anyone?
Also, might an Atlassian staff member comment on the question why this can be done in “old-school” Connect but not in the “new&fancy” Forge that’s being pushed? What’s the plan here?
Push. Any information is welcome.