# Intercept search events?

**URL:** <https://community.developer.atlassian.com/t/intercept-search-events/59417>\
**Category:** Confluence Cloud\
**Tags:** search\
**Created:** [June 27, 2022, 12:17pm UTC](https://community.developer.atlassian.com/t/intercept-search-events/59417 "2022-06-27T12:17:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohannesHausmann](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@JohannesHausmann](https://community.developer.atlassian.com/u/JohannesHausmann)\
**Post date:** [June 27, 2022, 12:17pm UTC](https://community.developer.atlassian.com/t/intercept-search-events/59417/1 "2022-06-27T12:17:42Z")

</div>

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.

Any ideas?  
Thanks,  
Joe

---

<div class="post-metadata">

**Author:** ![JohannesHausmann](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@JohannesHausmann](https://community.developer.atlassian.com/u/JohannesHausmann)\
**Post date:** [July 6, 2022, 8:24am UTC](https://community.developer.atlassian.com/t/intercept-search-events/59417/2 "2022-07-06T08:24:34Z")

</div>

Here is some progress I made.  
Generally following [these steps](https://developer.atlassian.com/platform/forge/automate-jira-using-triggers/?_ga=2.175592546.1534779264.1657021914-379503563.1657021914) I added the trigger module to my app. It captures events like “avi:confluence:viewed:page”. The list of events is available [here](https://developer.atlassian.com/platform/forge/events-reference/confluence/). 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](https://developer.atlassian.com/cloud/confluence/modules/webhook/) 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?  
Thanks,  
Joe

P.S.: the scope `search:confluence` doesn’t do the trick…

---

<div class="post-metadata">

**Author:** ![JohannesHausmann](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@JohannesHausmann](https://community.developer.atlassian.com/u/JohannesHausmann)\
**Post date:** [July 8, 2022, 7:32am UTC](https://community.developer.atlassian.com/t/intercept-search-events/59417/3 "2022-07-08T07:32:54Z")

</div>

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?

Thanks,  
Joe

---

<div class="post-metadata">

**Author:** ![JohannesHausmann](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@JohannesHausmann](https://community.developer.atlassian.com/u/JohannesHausmann)\
**Post date:** [September 30, 2022, 9:44am UTC](https://community.developer.atlassian.com/t/intercept-search-events/59417/4 "2022-09-30T09:44:35Z")

</div>

Push. Any information is welcome.

---

<div class="post-metadata">

**Author:** ![JohannesHausmann](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@JohannesHausmann](https://community.developer.atlassian.com/u/JohannesHausmann)\
**Post date:** [April 26, 2024, 10:50am UTC](https://community.developer.atlassian.com/t/intercept-search-events/59417/5 "2024-04-26T10:50:18Z")

</div>

Push again.  
Might an Atlassian staff member please 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?

Thanks,  
Joe
