---
title: "Navigation"
description: Navigate within the AppEngine and send Intents from one app to another.
---


Navigate within the AppEngine and send Intents from one app to another.

import NpmLogo from '@site/static/img/npm-logo.png';

<div class="row margin-bottom--md">
  <div class="col">
    <a href="https://www.npmjs.com/package/@dynatrace-sdk/navigation" target="_blank" rel="noopener noreferrer"> <span class="margin-right--xs">@dynatrace-sdk/navigation</span> <img className="no-zoom" width="20px" src={NpmLogo} /> </a>
  </div>
  <div class="col" style={{textAlign: 'right'}}>
    <a href="https://www.npmjs.com/package/@dynatrace-sdk/navigation/v/2.3.2" target="_blank" rel="noopener noreferrer">v2.3.2</a>
  </div>
</div>

```bash
npm install @dynatrace-sdk/navigation
```


## Functions



### getAppLink

<div class="padding-bottom--md">
<strong>getAppLink(appId,pageToken?): [string](https://developer.mozilla.org/en-US/docs/Glossary/String)</strong>

<div class="padding-left--md">

Generates a link that launches the specified app on current environment, with an optional internal route specified by pageToken

*Note:* There is no guarantee that the specified app will be launched since different sets of apps could be installed on different platform instances.
Relying on explicitly hardcoded app could lead to broken UX.

*Note:* A page token isn&apos;t a URL or route within your app.
It&apos;s a specific identifier in your app manifest that serves as a public API for navigation purposes.
App developers need to explicitly define these tokens in their manifest.
Learn more about [registering page tokens for routes](https://developer.dynatrace.com/develop/page-tokens/#register-page-token-for-a-route).



</div>


#### Parameters

| Name | Type | Description |
| --- | --- | --- |
|appId<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|ID of the app that will be launched.|
|pageToken|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|Id of the static path segment defining an internal route in app.  <em>Warning:</em> not the same thing as URL or route.|




#### Returns

| Return type | Description |
|---|---|
|[string](https://developer.mozilla.org/en-US/docs/Glossary/String) | URL to the specified app on current environment.|





</div>





### getDocumentLink

<div class="padding-bottom--md">
<strong>getDocumentLink(documentId): [string](https://developer.mozilla.org/en-US/docs/Glossary/String)</strong>

<div class="padding-left--md">

Generates a link that opens the specified document on current environment.

*Note:* Due to varying document availability across environments, there&apos;s no guarantee the link will always successfully open the document.



</div>


#### Parameters

| Name | Type | Description |
| --- | --- | --- |
|documentId<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The unique identifier (UUID or external ID) of the document to open.|




#### Returns

| Return type | Description |
|---|---|
|[string](https://developer.mozilla.org/en-US/docs/Glossary/String) | A URL for the document in the current environment.|





</div>





### getIntent

<div class="padding-bottom--md">
<strong>getIntent(): [Intent](#intent) &#124; null</strong>

<div class="padding-left--md">

Retrieves the intent data passed to the app.

`getIntent` method should be used only if the current app route is the intent handling route (`/intent/:intentId`). Otherwise, it returns `null`.

*Note:* The intent is passed to the destination app via the intent handling route (`/intent/:intentId`).
If the app has routing already configured, a new route for handling intents must be declared. Otherwise, it won&apos;t be possible to retrieve the intent.
If the app has no routing at all, it&apos;s not required to configure it.
To register intents your app can handle, you must declare them in your app manifest.
Learn more about [declaring the intents](https://developer.dynatrace.com/develop/intents/receive-intents/#declare-the-intents).



</div>



#### Returns

| Return type | Description |
|---|---|
|[Intent](#intent) | Intent accessor, including definition of desired action (intent id) and its payload.|





</div>





### getIntentLink

<div class="padding-bottom--md">
<strong>getIntentLink(intentPayload): [string](https://developer.mozilla.org/en-US/docs/Glossary/String)</strong>

<div class="padding-left--md">

Generates a link that launches the AppShell on current environment and lets it handle the specified intent.

*Note:* There is no guarantee that the specified app will be launched since different sets of apps could be installed on different platform instances.
Relying on explicitly hardcoded app could lead to broken UX.



</div>


#### Parameters

| Name | Type | Description |
| --- | --- | --- |
|intentPayload<sup>*required</sup>|[IntentPayload](#intentpayload)|Set of properties to pass to the platform.|




#### Returns

| Return type | Description |
|---|---|
|[string](https://developer.mozilla.org/en-US/docs/Glossary/String) | URL to the specified intent on current environment.|





</div>

<div class="padding-bottom--md">
<strong>getIntentLink(intentPayload,appId?,intentId?): [string](https://developer.mozilla.org/en-US/docs/Glossary/String)</strong>

<div class="padding-left--md">

Generates a link that launches the specified app on current environment and lets it handle the specified intent of given id.

*Note:* There is no guarantee that the specified app will be launched since different sets of apps could be installed on different platform instances.
Relying on explicitly hardcoded app could lead to broken UX.



</div>


#### Parameters

| Name | Type | Description |
| --- | --- | --- |
|intentPayload<sup>*required</sup>|[IntentPayload](#intentpayload)|Set of properties to pass to the specified app.|
|appId|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)||
|intentId|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|ID of the action that will be passed to the app.|




#### Returns

| Description |
|---|
|URL to the specified intent on current environment.|





</div>





### openApp

<div class="padding-bottom--md">
<strong>openApp(appId,pageToken?): void</strong>

<div class="padding-left--md">

Navigates user to the specified app, or its internal route if the `pageToken` is specified.

*Note:* A page token isn&apos;t a URL or route within your app.
It&apos;s a specific identifier in your app manifest that serves as a public API for navigation purposes.
App developers need to explicitly define these tokens in their manifest.
Learn more about [registering page tokens for routes](https://developer.dynatrace.com/develop/page-tokens/#register-page-token-for-a-route).
*Note:* There is no guarantee that the specified app exists since different sets of apps could be installed on different platform instances.
Relying on explicitly hardcoded app could lead to broken UX.



</div>


#### Parameters

| Name | Type | Description |
| --- | --- | --- |
|appId<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|ID of the app that will be launched.|
|pageToken|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|Id of the static path segment defining an internal route in app.  <em>Warning:</em> not the same thing as URL or route.|








</div>





### openDocument

<div class="padding-bottom--md">
<strong>openDocument(documentId): void</strong>

<div class="padding-left--md">

Navigates the user to the specified document on current environment.

*Note:* Due to varying document availability across environments, this function might not open the document if it doesn&apos;t exist in the environment.



</div>


#### Parameters

| Name | Type | Description |
| --- | --- | --- |
|documentId<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The unique identifier (UUID or external ID) of the document to navigate to.|








</div>





### sendIntent

<div class="padding-bottom--md">
<strong>sendIntent(intentPayload): void</strong>

<div class="padding-left--md">

Passes the specified `IntentPayload` to the Dynatrace platform, which then gets forwarded to the destination app selected by the user.

*Note:* The list of possible actions and destination apps includes only these actions/apps whose intent declarations are matched against the intent payload.
The matching checks whether the payload contains all the properties required in the intent declaration and whether the properties have the correct types.
All the undeclared properties are removed from the intent payload when passing it to the destination app.



</div>


#### Parameters

| Name | Type | Description |
| --- | --- | --- |
|intentPayload<sup>*required</sup>|[IntentPayload](#intentpayload)|an intent payload object to pass, it may include one or more properties|








</div>

<div class="padding-bottom--md">
<strong>sendIntent(intentPayload,sendIntentOptions): void</strong>

<div class="padding-left--md">

Passes the specified `IntentPayload` to the specified app and lets it handle the specified intent of given id.
If the specified app does not exist or the specified intent payload does not match,
Dynatrace platform handles the intent as if regular `sendIntent(intentPayload: IntentPayload)` is used.

*Note:* There is no guarantee that the specified app will be launched since different sets of apps could be installed on different platform instances.
And even if the app is installed, its version may not be capable of handling the specified intent payload.



</div>


#### Parameters

| Name | Type | Description |
| --- | --- | --- |
|intentPayload<sup>*required</sup>|T|an intent payload object to pass, it may include one or more properties|
|sendIntentOptions<sup>*required</sup>|SendIntentOptions&lt;T&gt;|<p>an options object with:</p> <ul> <li>recommendedAppId - ID of the app that will be launched to handle the intent</li> <li>recommendedIntentId - ID of the action that will be passed to the app</li> <li>keyProperties - list of property names of the intent payload that must be matched with intent declarations</li> </ul> |








</div>





### sendIntentWithResponse

<div class="padding-bottom--md">
<strong>sendIntentWithResponse(intentPayload,sendIntentWithResponseOptions): Promise&lt;IntentResponseEnvelope&lt;T&gt; &#124; undefined&gt;</strong>

<div class="padding-left--md">

Unlike regular `sendIntent` method, it requests what properties will be returned by the specified app handling the specified intent of given id.

*Note:* The list of possible actions and destination apps includes only these actions/apps whose intent declarations are matched against the intent payload and response properties.



</div>


#### Parameters

| Name | Type | Description |
| --- | --- | --- |
|intentPayload<sup>*required</sup>|[IntentPayload](#intentpayload)|an intent payload object to pass, it may be empty when sending an intent with response|
|sendIntentWithResponseOptions<sup>*required</sup>|SendIntentWithResponseOptions&lt;T&gt;|<p>an options object with:</p> <ul> <li>responseProperties - expected intent response, requested as a list of property names</li> <li>recommendedAppId - ID of the app that will be launched to handle the intent</li> <li>recommendedIntentId - ID of the action that will be passed to the app</li> </ul> |








</div>





### setPathChangeHandler

<div class="padding-bottom--md">
<strong>setPathChangeHandler(handler): void</strong>

<div class="padding-left--md">

Registers a custom handler for changing the app&apos;s URL path.
It is used only for the changes that are triggered externally, outside the app.

If a custom handler is not set, the application is reloaded
by replacing the current document location with a new path.



</div>


#### Parameters

| Name | Type | Description |
| --- | --- | --- |
|handler<sup>*required</sup>|PathChangeHandler|Custom handler for changing the app's URL path.|








</div>



## Types

### Intent
Intent accessor API for retrieving received intent.

Use it to retrieve the intent payload passed from the source app and the intent id selected by the user.


#### Methods



##### getId

<div class="padding-bottom--md">
<strong>getId(): [string](https://developer.mozilla.org/en-US/docs/Glossary/String)</strong>

<div class="padding-left--md">

Retrieves the intent id selected by the user.

It is passed via the intent handling route (`/intent/:intentId`).



</div>



#### Returns

| Return type | Description |
|---|---|
|[string](https://developer.mozilla.org/en-US/docs/Glossary/String) | intent id|





</div>





##### getPayload

<div class="padding-bottom--md">
<strong>getPayload(): [IntentPayload](#intentpayload)</strong>

<div class="padding-left--md">

Retrieves the intent payload object that was passed from the source app.

It contains only these properties that are declared in the app manifest.



</div>



#### Returns

| Return type | Description |
|---|---|
|[IntentPayload](#intentpayload) | Intent payload|





</div>





##### getProperty

<div class="padding-bottom--md">
<strong>getProperty(propertyName): [any](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any)</strong>

<div class="padding-left--md">

Retrieves value of a given property name from the intent payload.



</div>


#### Parameters

| Name | Type |
| --- | --- |
|propertyName<sup>*required</sup>|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|








</div>




### IntentPayload
Set of properties that could be passed between apps.

*Note:* The intent payload contains one or more properties. The properties may be a resource-like (i.e., `dt.entity`, `dt.query`) and may define an additional context (i.e., chosen timeframe, associated problem)
Intents mechanism is the essential part of the platform navigation. It allows to pass the user flow from one app to another and provides the way to plug different apps into these flows, making the platform open and extendable.
Use [sendIntent](#sendintent) to pass the intent payload to the platform.
Use [getIntent](#getintent) to handle intents in your app.


### IntentResponseErrorEnvelope



#### Properties

| Name | Type |
| --- | --- |
|error<sup>*required</sup>|IntentError|
|ok<sup>*required</sup>|false|


### IntentResponseOkEnvelope



#### Properties

| Name | Type |
| --- | --- |
|data<sup>*required</sup>||
|ok<sup>*required</sup>|true|


