---
# System prepended metadata

title: Intent Overview - for Application Developers

---

# Intent Overview - for Application Developers

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

As you deploy your Application into the OpenFin Workspace, you may wish to make a service you developed available to other apps. Alternatively, you may want your application to utilize a service that is already available in another app.

If so, you should look into Intents.

An intent involves two players: A view that fires the intent (“can someone handle this for me?”), and another view that registers an Intent handler (“I could handle that”).

Intent distribution and resolution is controlled by the Platform's InteropBroker. For more information on that see the [Intents for Platform Developers](https://hackmd.io/@TomerSh/intents_for_platform_devs) documentation.


# fin.me.interop.fireIntent
This fires the specified Intent to be handled by a registered handler. 

Example
```
// View wants to fire an Intent after a user clicks on a ticker

tickerElement.on('click', (element) => {
    const ticker = element.innerText;
    const intent = {
        name: 'ViewChart',
        context: { 
            type: 'fdc3.instrument', 
            id: { ticker }
        }
    }

    fin.me.interop.fireIntent(intent);
});

```




:::info
Intents require Platform support to be operational. If you are using OpenFin Browser, you get that functionality out-of-the-box. Otherwise, make sure your Platform developers follow the guidelines laid out [here](https://hackmd.io/@TomerSh/intents_for_platform_devs).
:::
Note: Intents are fire-and-forget by design, therefore `fireIntent` doesn’t return anything.

# fin.me.interop.registerIntentHandler

Any OpenFin View that would like to register itself as a handler of certain intents must call this method and pass it a handler function. The method then returns an unsubscribe handler that could be called if the View chooses to stop handling said Intents.

The logic for picking one intent handler over another is handled by the Platform, and is discussed in the InteropBroker's [Intents for Platform Developers](https://hackmd.io/@TomerSh/intents_for_platform_devs) documentation.

Example:
```
const viewChartIntentHandler = (intent) => {
    const { context } = intent;
    myViewChartHandler(context);
};

const subscription = await fin.me.interop.registerIntentHandler(viewChartIntentHandler, 'ViewChart');

function myAppCloseSequence() {
    // to unsubscribe the handler, simply call:
    subscription.unsubscribe();
}
```
Note that this function should only be called once in the View’s lifecycle. Further calls will throw an error.



