# Connect User Events
source: https://developer.mastercard.com/open-finance-au/documentation/connect/integrating-with-connect/events/connect-user-events/index.md

User events provide full visibility into the customer's actions while they're interacting with the Connect Connect Lite, or Connect Fix applications (apps). These events are compatible with analytics tools, allowing you to build web analytics dashboards to evaluate conversions, success rates, and error rates.

## AddAccounts {#addaccounts}

|    Name     |       Connect Support       |                     Description                     |
|-------------|-----------------------------|-----------------------------------------------------|
| AddAccounts | Connect Full / Connect Lite | Sent when a customer attempt to add their accounts. |

This event is sent two times. The first event is sent when the customer attempts to add their bank accounts. The return includes:

* A null value for the `success`, `accounts`, and `errorCode` fields.
* The second event sent provides the details about the attempt.

The customer successfully added their accounts if:

* `accounts` = populated
* `success` = true
* `errorCode` = null
The customer failed to add their accounts if:

* `accounts` = null
* `success` = false
* `errorCode` = populated
Note: If the first event is received, but the second event never arrives, then the customer ended the attempt to add accounts before Connect could successfully add the accounts.

**Example response (first event):**

```JSON
{
  "action": "AddAccounts",
  "institutionId": 123,
  "institutionLoginId": null,
  "accounts": null,
  "accountIds": [],
  "success": null,
  "errorCode": null
}
```

**Example response (second event success):**

```JSON
{
  "action": "AddAccounts",
  "institutionId": 123,
  "institutionLoginId": 456,
  "accounts": 5,
  "accountIds": [
    "7079115306",
    "7079115307",
    "7079115308",
    "7079115309",
    "7079115310"
  ],
  "success": true,
  "errorCode": null
}
```

**Example response (second event fail):**

```JSON
{
  "action": "AddAccounts",
  "institutionId": 123,
  "institutionLoginId": null,
  "accounts": null,
  "accountIds": [],
  "success": false,
  "errorCode": 500
}
```

## DisplayAlert {#displayalert}

|     Name     |              Connect Support              |                                                           Description                                                           |
|--------------|-------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
| DisplayAlert | Connect Full / Connect Lite / Connect Fix | Sent when a customer receives an alert within a Connect session. The return includes: * The error code * The error code message |

Note: These fields are only sent if an alert occurs for an FI:

* `institutionId`
* `institutionName`

**Example response:**

```JSON
{
  "action": "DisplayAlert",
  "alertType": "ERROR",
  "title": "Error",
  "message": "An error occurred.",
  "errorCode": 500,
  "data": {
    "details": "Invalid input"
  }
}
```

## End {#end}

| Name |      Connect Support       |                                                                          Description                                                                          |
|------|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| End  | Connect Full / Connect Fix | Sent when a customer ends a Connect session. See [Error Handling](https://developer.mastercard.com/open-finance-au/documentation/errors/error-list/index.md). |

Note: Used to indicate how many customers have left a Connect session within your own product applications.

**Example response:**

```JSON
{
  "action": "End",
  "reason": "complete",
  "customerId": 12345,
  "partnerId": 67890,
  "timestamp": 1717132800000,
  "ttl": 1717140000000,
  "experience": "550e8400-e29b-41d4-a716-446655440000",
  "sessionId": "7035b169d6f13306a240e7291bf7eab1a28010af26b57249ca1ccf5c49a30ce4",
  "code": 200,
  "type": "full",
  "product": "aggregation"
}
```

## FixMfaAttempt {#fixmfaattempt}

|     Name      | Connect Support |                        Description                        |
|---------------|-----------------|-----------------------------------------------------------|
| FixMfaAttempt | Connect Fix     | Sent when a customer attempts to answer an MFA challenge. |

This event is sent two times. The first event is sent when the customer attempts to answer an MFA challenge question while signing in to their bank. The return includes:

* A null value for the `success`, `accounts`, and `errorCode` fields.

A second event sent provides the details about the attempt.
The customer successfully signed in to their accounts if:

* `accounts` = populated
* `success` = true
* `errorCode` = null
The customer encountered another MFA challenge if:

* `accounts` = null
* `success` = true
* `errorCode` = null
The customer failed to sign in to their accounts if:

* `success` = false
* `errorCode` = populated

**Example response (first event):**

```JSON
{
  "action": "FixMfaAttempt",
  "institutionId": 123,
  "institutionLoginId": 456,
  "accounts": 5,
  "accountIds": [
    "7079115306",
    "7079115307",
    "7079115308",
    "7079115309",
    "7079115310"
  ],
  "success": null,
  "errorCode": null
}
```

**Example response (second event success):**

```JSON
{
  "action": "FixMfaAttempt",
  "institutionId": 123,
  "institutionLoginId": 456,
  "accounts": 5,
  "accountIds": [
    "7079115306",
    "7079115307",
    "7079115308",
    "7079115309",
    "7079115310"
  ],
  "success": true,
  "errorCode": null
}
```

**Example response (second event fail):**

```JSON
{
  "action": "FixMfaAttempt",
  "institutionId": 123,
  "institutionLoginId": 456,
  "accounts": 5,
  "accountIds": [
    "7079115306",
    "7079115307",
    "7079115308","7079115309",
    "7079115310"
  ],
  "success": false,
  "errorCode": 185
}
```

## FixSignInAttempt {#fixsigninattempt}

|       Name       | Connect Support |                                        Description                                        |
|------------------|-----------------|-------------------------------------------------------------------------------------------|
| FixSignInAttempt | Connect Fix     | Sent when a customer tries attempts to sign in when fixing a connection to their account. |

This event is sent two times. The first event is sent when the customer attempts to sign in to their bank. The return includes:

* A null value for the `success`, `accounts`, and `errorCode` fields.

A second event sent provides the details about the attempt.
The customer successfully fixed the sign in for the account if:

* `accounts` = populated
* `success` = true
* `errorCode` = null
The customer encountered an MFA challenge if:

* `accounts` = null
* `success` = true
* `errorCode` = null
The customer failed to fix the sign in for their account if:

* `success` = false
* `errorCode` = populated
Note: If the first event is received, but the second event never arrives, then the customer ended the attempt to fix their sign-in beforData could successfully connect to the FI.

**Example response (first event):**

```JSON
{
  "action": "FixSignInAttempt",
  "institutionId": 456,
  "institutionLoginId": 789,
  "accounts": 5,
  "accountIds": [
    "7079115306",
    "7079115307",
    "7079115308",
    "7079115309",
    "7079115310"
  ],
  "success": null,
  "errorCode": null
}
```

**Example response (second event success):**

```JSON
{
  "action": "FixSignInAttempt",
  "institutionId": 456,
  "institutionLoginId": 789,
  "accounts": 5,
  "accountIds": [
    "7079115306",
    "7079115307",
    "7079115308",
    "7079115309",
    "7079115310"
  ],
  "success": true,
  "errorCode": null
}
```

**Example response (second event fail):**

```JSON
{
  "action": "FixSignInAttempt",
  "institutionId": 456,
  "institutionLoginId": 789,
  "accounts": 5,
  "accountIds": [
    "7079115306",
    "7079115307",
    "7079115308",
    "7079115309",
    "7079115310"
  ],
  "success": false,
  "errorCode": 103
}
```

## Initialize {#initialize}

|    Name    |      Connect Support       |                Description                 |
|------------|----------------------------|--------------------------------------------|
| Initialize | Connect Full / Connect Fix | Sent when a user starts a Connect session. |

**Example response:**

```JSON
{
   "action": "Initialize",
   "customerId": 12345,
   "partnerId": 67890,
   "timestamp": 1717132800000,
   "ttl": 1717140000000,
   "type": "full",
   "experience": "550e8400-e29b-41d4-a716-446655440000",
   "sessionId": "7035b169d6f13306a240e7291bf7eab1a28010af26b57249ca1ccf5c49a30ce4",
   "product": "aggregation",
   "borrowerType": "primary"
}
```

## LaunchOAuth {#launchoauth}

|    Name     | Connect Support |                       Description                       |
|-------------|-----------------|---------------------------------------------------------|
| LaunchOAuth | Connect Full    | Sent when the customer opens an OAuth window for an FI. |

Note: If no other OAuth events are received after this event, then the customer most likely closed the OAuth window.

**Example response:**

```JSON
{
  "action": "LaunchOAuth",
  "institutionId": 789,
  "success": true,
  "errorCode": null
}
```

## MfaAttempt {#mfaattempt}

|    Name    |              Connect Support              |                         Description                         |
|------------|-------------------------------------------|-------------------------------------------------------------|
| MfaAttempt | Connect Full / Connect Lite / Connect Fix | Sent when the customer attempts to answer an MFA challenge. |

This event is sent two times. The first event is sent when the customer attempts to sign in to their bank. The return includes:

* A null value for the `success`, `accounts`, and `errorCode` fields.

A second event sent provides the details about the attempt.
The customer successfully signed in to their accounts if:

* `accounts` = populated
* `success` = true
* `errorCode` = null
The customer encountered another MFA challenge if:

* `accounts` = null
* `success` = true
* `errorCode` = null
The customer failed to sign in to their accounts if:

* accounts= null
* success= false
* errorCode= populated

**Example response (first event):**

```JSON
{
  "action": "MfaAttempt",
  "institutionId": 123,
  "accounts": null,
  "accountIds": [],
  "success": null,
  "errorCode": null
}
```

**Example response (second event success):**

```JSON
{
  "action": "MfaAttempt",
  "institutionId": 123,
  "accounts": 5,
  "accountIds": [
    "7079115306",
    "7079115307",
    "7079115308",
    "7079115309",
    "7079115310"
  ],
  "success": true,
  "errorCode": null
}
```

**Example response (second event fail):**

```JSON
{
  "action": "MfaAttempt",
  "institutionId": 123,
  "accounts": null,
  "accountIds": [],
  "success": null,
  "errorCode": 185
}
```

## OAuthAddAccounts {#oauthaddaccounts}

|       Name       | Connect Support |                            Description                             |
|------------------|-----------------|--------------------------------------------------------------------|
| OAuthAddAccounts | Connect Full    | Sent when the customer attempts to add an OAuth account for an FI. |

**Example response:**

```JSON
{
  "action": "OAuthAddAccounts",
  "institutionId": 123,
  "institutionLoginId": 456,
  "accounts": 5,
  "accountIds": [
    "7079115306",
    "7079115307",
    "7079115308",
    "7079115309",
    "7079115310"
  ],
  "success": true,
  "errorCode": null
}
```

## OAuthSignInAttempt {#oauthsigninattempt}

|        Name        | Connect Support |                                Description                                |
|--------------------|-----------------|---------------------------------------------------------------------------|
| OAuthSignInAttempt | Connect Full    | Sent when the customer attempts to sign in to an OAuth account for an FI. |

**Example response:**

```JSON
{
  "action": "OAuthSignInAttempt",
  "institutionId": 456,
  "success": true,
  "errorCode": null
}
```

## RemoveAccounts {#removeaccounts}

|      Name      | Connect Support |                     Description                      |
|----------------|-----------------|------------------------------------------------------|
| RemoveAccounts | Connect Full    | Sent when a customer tries to remove their accounts. |

This event is sent two times. The first event is sent when the customer attempts to sign in to their bank. The return includes:

* A null value for the `success`, `accounts`, and `errorCode` fields.

A second event is sent with the results about the customer's attempt to remove their accounts:

* Successfully removes accounts
* Failed to remove accounts

Note: If the first event is received, but the second event never arrives, then the customer ended the attempt to remove their accounts before Connect could successfully remove them.

**Example response (first event):**

```JSON
{
  "action": "RemoveAccounts",
  "institutionId": 123,
  "institutionLoginId": null,
  "accounts": null,
  "accountIds": [],
  "success": null,
  "errorCode": null
}
```

**Example response (second event success):**

```JSON
{
  "action": "RemoveAccounts",
  "institutionId": 123,
  "institutionLoginId": 456,
  "accounts": 5,
  "accountIds": [
    "7079115306",
    "7079115307",
    "7079115308",
    "7079115309",
    "7079115310"
  ],
  "success": true,
  "errorCode": null
}
```

**Example response (second event fail):**

```JSON
{
  "action": "RemoveAccounts",
  "institutionId": 123,
  "institutionLoginId": null,
  "accounts": null,
  "accountIds": [],
  "success": false,
  "errorCode": 500
}
```

## SearchInstitutions {#searchinstitutions}

|        Name        | Connect Support |             Description              |
|--------------------|-----------------|--------------------------------------|
| SearchInstitutions | Connect Full    | Sent when a user searches for an FI. |

The return includes:

* The customer's query search words.
* The number of matching search results.
* The number of times the customer attempted to search.

Note: The event is only sent if this condition occurs: at least three letters are typed and the customer pauses after typing for 300 ms.

**Example response:**

```JSON
{
  "action": "SearchInstitutions",
  "searchTerm": "Bank of America",
  "resultCount": 5
}
```

## SelectInstitution {#selectinstitution}

|       Name        | Connect Support |                     Description                     |
|-------------------|-----------------|-----------------------------------------------------|
| SelectInstitution | Connect Full    | Sent when the customer selects an FI to sign in to. |

The return includes:

* The institution ID the customer selected.
* If the FI is supported for the product.

**Example response:**

```JSON
{
  "action": "SelectInstitution",
  "institutionId": 123,
  "supported": true
}
```

## SessionTimeout {#sessiontimeout}

|      Name      |              Connect Support              |                           Description                           |
|----------------|-------------------------------------------|-----------------------------------------------------------------|
| SessionTimeout | Connect Full / Connect Lite / Connect Fix | Sent when a customer's session has timed out due to inactivity. |

**Example response:**

```JSON
{
  "action": "SessionTimeout",
  "customerId": 12345,
  "partnerId": 67890,
  "timestamp": 1717132800000,
  "sessionId": "7035b169d6f13306a240e7291bf7eab1a28010af26b57249ca1ccf5c49a30ce4"
}
```

## SignInAttempt {#signinattempt}

|     Name      | Connect Support |                       Description                       |
|---------------|-----------------|---------------------------------------------------------|
| SignInAttempt | Connect Full    | Sent when a customer attempts to sign in to an account. |

This event is sent two times. The first event is sent when the customer attempts to sign in to their bank. The return includes:

* A null value for the `success`, `accounts`, and `errorCode` fields.

A second event sent provides the details about the attempt.
The customer successfully signed in to their accounts if:

* `accounts` = populated
* `success` = true
* `errorCode` = null
The customer encountered an MFA challenge if:

* `accounts` = null
* `success` = true
* `errorCode` = null
The customer failed to sign in to their accounts if:

* `accounts` = null
* `success` = false
* `errorCode` = populated
Note: If the first event is received, but the second event never arrives, then the customer ended the attempt before Connect successfully connected to the FI.

**Example response (first event):**

```JSON
{
  "action": "SignInAttempt",
  "institutionId": 456,
  "accounts": null,
  "accountIds": [],
  "success": null,
  "errorCode": null
}
```

**Example response (second event success):**

```JSON
{
  "action": "SignInAttempt",
  "institutionId": 456,
  "accounts": 5,
  "accountIds": [
    "7079115306",
    "7079115307",
    "7079115308",
    "7079115309",
    "7079115310"
  ],
  "success": true,
  "errorCode": 0
}
```

**Example response (second event fail):**

```JSON
{
  "action": "SignInAttempt",
  "institutionId": 456,
  "accounts": null,
  "accountIds": [],
  "success": false,
  "errorCode": 103
}
```

## SubmitAccounts {#submitaccounts}

|      Name      | Connect Support |                        Description                        |
|----------------|-----------------|-----------------------------------------------------------|
| SubmitAccounts | Connect Full    | Sent when the customer attempts to submit their accounts. |

The return includes:

* The accounts

This user event indicates:

* The customer attempted to submit their accounts.
* The account number if the customer's attempt to submit accounts was successful.

**Example response:**

```JSON
{
  "action": "SubmitAccounts",
  "customerId": 12345,
  "partnerId": 67890,
  "timestamp": 1717132800000,
  "ttl": 1717140000000,
  "type": "full",
  "experience": "550e8400-e29b-41d4-a716-446655440000",
  "sessionId": "7035b169d6f13306a240e7291bf7eab1a28010af26b57249ca1ccf5c49a30ce4",
  "product": "aggregation"
}
```

