Add Buttons and Handlers to an Extension App
Prerequisites
Complete the previous guide on building an extension app with app views
Build an Extension App with App ViewsAdd Buttons and Handler
Let's now add a button to the hashtag hover card and a handler to link the context. Use ADK.buttons.add
to add a new button to the hashtag
zone. To pass the context payload from the controller to the view, there are two options: either using query parameters or using ADK to invoke an exposed controller method from a view.
Option 1: Use query parameters to pass context
In this option, we serialize the contents of the context payload and pass it directly into the ADK.modules.open
call as query parameters.
Once the view is opened, you can retrieve the query parameters and deserialize it.
Option 2: Expose Method on Controller
In this option, we store the state of context on the controller, then expose a method to retrieve that state.
Once the view is opened, you can make a call to the exposed getContext
method via the useRemoteExecutor
hook, which returns a promise.
Last updated