

# Amazon Connect Agent Workspace AppController API
<a name="api-reference-3P-apps-app-controller"></a>

The Amazon Connect SDK provides an `AppControllerClient` to control applications in the Amazon Connect agent workspace.

The `AppControllerClient` accepts an optional argument, ` ConnectClientConfig` which itself is defined as:

```
export type ConnectClientConfig = {  
    context?: ModuleContext;  
    provider?: AmazonConnectProvider;
};
```

If you do not provide a value for this config, then the client will default to using the ** AmazonConnectProvider** set in the global provider scope. You can also manually configure this using **setGlobalProvider**.

You can instantiate the AppControllerClient as follows:

```
import { AppControllerClient } from "@amazon-connect/app-controller";

const appControllerClient = new AppControllerClient({ provider });
```

The following sections describe API calls for working with the App Controller API.

**Topics**
+ [closeApp()](api-reference-3P-apps-app-controller-closeapp.md)
+ [focusApp()](api-reference-3P-apps-app-controller-focusapp.md)
+ [getApp()](api-reference-3P-apps-app-controller-getapp.md)
+ [getAppCatalog()](api-reference-3P-apps-app-controller-getappcatalog.md)
+ [getAppConfig()](api-reference-3P-apps-app-controller-getappconfig.md)
+ [getApps()](api-reference-3P-apps-app-controller-getapps.md)
+ [launchApp()](api-reference-3P-apps-app-controller-launchapp.md)

# Close an application in Amazon Connect Agent Workspace
<a name="api-reference-3P-apps-app-controller-closeapp"></a>

Closes the application for the given application instance ID in the Amazon Connect agent workspace.

 **Signature** 

```
closeApp(instanceId: string): Promise<void>
```

 **Usage** 

```
await appControllerClient.closeApp(appInstanceId);
```

 **Input** 


|  **Parameter**  |  **Type**  |  **Description**  | 
| --- | --- | --- | 
| appInstanceId Required | string | The instance ID of the application | 

 **Permissions required:** 

```
*
```

# Focus an application in Amazon Connect Agent Workspace
<a name="api-reference-3P-apps-app-controller-focusapp"></a>

Brings the application into focus in the Amazon Connect agent workspace for the given application instance ID.

 **Signature** 

```
focusApp(instanceId: string): Promise<AppFocusResult>
```

 **Usage** 

```
const applicationFocusResult: AppFocusResult = await appControllerClient.focusApp(appInstanceId);
```

 **Input** 


|  **Parameter**  |  **Type**  |  **Description**  | 
| --- | --- | --- | 
| appInstanceId Required | string | The instance ID of the application | 

 **Output - AppFocusResult** 


|  **Parameter**  |  **Type**  |  **Description**  | 
| --- | --- | --- | 
| instanceId | string | The AmazonResourceName(ARN) of the application | 
| result | "queued" \$1 "completed" \$1 "failed" | Indicates if the request is queued, completed or failed | 

 **Permissions required:** 

```
*
```

# Get application information in Amazon Connect Agent Workspace
<a name="api-reference-3P-apps-app-controller-getapp"></a>

Returns the application information for the given application instance ID in the Amazon Connect agent workspace.

 **Signature** 

```
getApp(instanceId: string): Promise<AppInfo>
```

 **Usage** 

```
const applicationInfo: AppInfo = await appControllerClient.getApp(appInstanceId);
```

 **Input** 


|  **Parameter**  |  **Type**  |  **Description**  | 
| --- | --- | --- | 
| appInstanceId Required | string | The instance ID of the application | 

 **Output - AppInfo** 


|  **Parameter**  |  **Type**  |  **Description**  | 
| --- | --- | --- | 
| instanceId | string | Unique ID of the application instance | 
| config | Config | The configuration of the application | 
| startTime | Date | Time when the application is launched | 
| state | AppState | Current state of the application | 
| appCreateOrder | number | Sequentially incremented counter upon new application launches | 
| accessUrl | string | Access URL of the application | 
| parameters | AppParameters \$1 undefined | Key value pair of parameters passed to the application | 
| launchKey | string | A unique id to avoid duplicate application being launched with multiple invocation of launchApp API | 
| scope | ContactScope \$1 IdleScope | Indicates if the application is launched with idle i.e when there are no contacts or launched during an active contact | 

 **Permissions required:** 

```
*
```

# Get the application catalog in Amazon Connect Agent Workspace
<a name="api-reference-3P-apps-app-controller-getappcatalog"></a>

Returns all the applications that are available in the Amazon Connect agent workspace for the current logged-in user.

 **Signature** 

```
getAppCatalog(): Promise<AppConfig[]>
```

 **Usage** 

```
const applications: AppConfig[] = await appControllerClient.getAppCatalog();
```

 **Output - AppConfig** 


|  **Parameter**  |  **Type**  |  **Description**  | 
| --- | --- | --- | 
| arn | string | The AmazonResourceName(ARN) of the application | 
| namespace | string | The immutable application namespace used at the time of registration | 
| id | string | The unique identifier of the application | 
| name | string | Name of the application | 
| description | string | Description of the application | 
| accessUrl | string | URL to access the application | 
| initializationTimeout | number | The maximum time allowed in milliseconds to establish a connection with the workspace | 
| contactHandling.scope | PER\$1CONTACT \$1 CROSS\$1CONTACTS | Indicates whether the application refreshes for each contact | 

 **Permissions required:** 

```
*
```

# Get the application configuration in Amazon Connect Agent Workspace
<a name="api-reference-3P-apps-app-controller-getappconfig"></a>

Returns the application configuration for the given application ARN in the Amazon Connect agent workspace.

 **Signature** 

```
getAppConfig(appArn: string): Promise<AppConfig>
```

 **Usage** 

```
const applicationConfig: AppConfig = await appControllerClient.getAppConfig(arn);
```

 **Input** 


|  **Parameter**  |  **Type**  |  **Description**  | 
| --- | --- | --- | 
| arn Required | string | The ARN of the application | 

 **Output - AppConfig** 


|  **Parameter**  |  **Type**  |  **Description**  | 
| --- | --- | --- | 
| arn | string | The AmazonResourceName(ARN) of the application | 
| namespace | string | The immutable application namespace used at the time of registration | 
| id | string | The unique identifier of the application | 
| name | string | Name of the application | 
| description | string | Description of the application | 
| accessUrl | string | URL to access the application | 
| initializationTimeout | number | The maximum time allowed to establish a connection with the workspace | 
| contactHandling.scope | PER\$1CONTACT \$1 CROSS\$1CONTACTS | Indicates whether the application refreshes for each contact | 

 **Permissions required:** 

```
*
```

# Get all active application information in Amazon Connect Agent Workspace
<a name="api-reference-3P-apps-app-controller-getapps"></a>

Returns the application information for all active application instances in the Amazon Connect agent workspace.

 **Signature** 

```
getApps(): Promise<AppInfo[]>
```

 **Usage** 

```
const applicationInfo: AppInfo[] = await appControllerClient.getApps();
```

 **Output - AppInfo** 


|  **Parameter**  |  **Type**  |  **Description**  | 
| --- | --- | --- | 
| instanceId | string | Unique ID of the application instance | 
| config | Config | The configuration of the application | 
| startTime | Date | Time when the application is launched | 
| state | AppState | Current state of the application | 
| appCreateOrder | number | Sequentially incremented counter upon new application launches | 
| accessUrl | string | Access URL of the application | 
| parameters | AppParameters \$1 undefined | Key value pair of parameters passed to the application | 
| launchKey | string | A unique id to avoid duplicate application being launched with multiple invocation of launchApp API | 
| scope | ContactScope \$1 IdleScope | Indicates if the application is launched with idle i.e when there are no contacts or launched during an active contact | 

 **Permissions required:** 

```
*
```

# Launch an application in Amazon Connect Agent Workspace
<a name="api-reference-3P-apps-app-controller-launchapp"></a>

Launch the application in the agent workspace for the given application ARN or name. It supports optional launch options to fine tune the launch behavior.

 **Signature** 

```
launchApp(arnOrName: string, options?: AppLaunchOptions): Promise<AppInfo>
```

 **Usage** 

```
const applicationsConfig: AppConfig[] = await appControllerClient.getAppCatalog();
const appInfo: AppInfo = await appControllerClient.launchApp(applicationsConfig[0].arn);
```

 **Input** 


|  **Parameter**  |  **Type**  |  **Description**  | 
| --- | --- | --- | 
| arnOrName Required | string | The ARN or name of the application | 
| options.parameters | AppParameters | Key value pair of parameters passed to the application | 
| options.launchKey | string | A unique id to avoid duplicate application being launched with multiple invocation of launchApp API | 
| options.openInBackground | boolean | If set to true, the application won't be set to focus after its launched | 
| options.scope | ContactScope \$1 IdleScope | Indicates if the application is launched with idle i.e when there are no contacts or launched during an active contact | 

 **Output - AppInfo** 


|  **Parameter**  |  **Type**  |  **Description**  | 
| --- | --- | --- | 
| instanceId | string | Unique ID of the application instance | 
| config | Config | The configuration of the application | 
| startTime | Date | Time when the application is launched | 
| state | AppState | Current state of the application | 
| appCreateOrder | number | Sequentially incremented counter upon new application launches | 
| accessUrl | string | Access URL of the application | 
| parameters | AppParameters \$1 undefined | Key value pair of parameters passed to the application | 
| launchKey | string | A unique id to avoid duplicate application being launched with multiple invocation of launchApp API | 
| scope | ContactScope \$1 IdleScope | Indicates if the application is launched with idle i.e when there are no contacts or launched during an active contact | 

 **Permissions required:** 

```
*
```