---
# System prepended metadata

title: Intent Overview - for Platform Developers

---

# Intent Overview - for Platform Developers
This section of the Intents documentation is directed at Platform developers looking to facilitate and manage Intent distribution in their Platform. If you are an application developer, see [Intents for Application Developers](https://hackmd.io/@TomerSh/intents_for_app_devs)

An intent is a description of an operation to be performed by someone else in the OpenFin eco-system.

Intents are fired, picked up and handled by Views. Views use the [fireIntent](link) and the [registerIntentHandler](link) endpoints to dispatch and intercept Intents respectively.

**The platform is responsible** for selecting a handler for a fired intent. It does so by **(1)** Overriding `handleFiredIntent` to handle incoming fired intents and **(2)** Calling the `setIntentTarget` method to let the platform know which View will be handing the Intent.

:::info 
**Important** 

 Both the `handleFiredIntent` override and the `setIntentTarget` call **must be present** in order for the intent to be treated. Otherwise it will get ignored.
:::
Example -

```
// platform-provider.js
interopOverride: async (InteropBroker, provider, options, ...args) => {  
    class Override extends InteropBroker {  
        async handleFiredIntent(intent) {
        
            // Apply some logic to select a handler View
            const targetHandler = await promptUserToChooseApp(intent);
            
            // In this example, all handlers live in the same window:
            const handlerHost = fin.Window.wrapSync({uuid: 'my-uuid', name: 'handler-host'});
            
            // In this example, only one Instance of the handler can exist. Let's check if it was already launched:
            const openHandlers = await handlerHost.getCurrentViews();
            const isTargetHandlerOpen = !!openHandlers.filter(handler => handler.identity.name === targetHandler.name).length;
            
            // If the handler View isn't running, launch it. 
            if(!isTargetHandlerOpen) {
                platform.createView({ ...targetHandler }, { uuid: 'platform-uuid', name: 'handler-host-window-name' });
            }
            
            // This makes sure the Handler gets the Intent as soon as it is ready (i.e. registerIntentHandler was called)
            interopBroker.setIntentTarget(intent, targetHandler);
        }
    }
}
```



The following illustrates the lifecycle of an Intent, with the Platform related implementation in red: 

![](https://i.imgur.com/WLvG2ul.png)



To illustrate what each of these APIs do in our workflow above:

1.  A user clicks on a ticker in a View - `fin.me.interop.fireIntent(intent)`
2.  The Platform shows a UI for picking a View to open - `interopBroker.handleFiredIntent(intent)`
3.  A user chooses a View - `interopBroker.setIntentTarget(intent, target)`
4.  The View comes up in the Platform (Handled by the Platform)
5.  The View receives the Intent - `fin.me.interop.registerIntentHandler(handler)`

Note that the `handleFiredIntent` method doesn't resolve with the selected Target. Instead, `setIntentTarget` can be called multiple times and at any moment. This is done by design to facilitate the fire-and-forget nature of Intents and give total control to the Platform Developer.

Another thing to note is that while `registerIntentHandler` is certainly part of the lifecycle, it doesn't have to be called in any particular order - before a View calls the method, any incoming Intents will get queued up and sent to the View as soon as `registerIntentHandler` is called.