- If you’ve redirected your app to the Connect Webview, poll or use a webhook to determine when the Connect Webview has completed successfully. You can then retrieve the device or ACS associated with the newly-connected account.
- If you’ve embedded the Connect Webview in an iframe, use event listening to determine when to close the iframe. You can then retrieve the device or ACS associated with the newly-connected account.
You do not need to delete a Connect Webview once a user completes it. Instead,
you can simply ignore completed Connect Webviews.
Polling
Use theconnect_webview_id to retrieve the Connect Webview instance. You can check the following properties:
| Property | Value when connected successfully |
|---|---|
status | authorized |
login_successful | true |
connect_webview object includes a connected_account_id.
- JavaScript
- cURL
- Python
- Ruby
- PHP
- C#
Code:Output:
Webhook
When Seam successfully establishes the connection to the user’s device or ACS account, Seam emits aconnected_account.connected event. This event includes a connect_webview_id property.
To avoid polling, use a Seam webhook to monitor for a connected_account.connected event with a connect_webview_id that matches the connect_webview_id of the appropriate Connect Webview instance.
Note that the connected_account.connected event also includes a connected_account_id property.
For more information, see Webhooks.
Event Listening
When you host a Connect Webview in an HTML iframe, the iframe useswindow.parent.postMessage to send messages to the parent window that is hosting the iframe. window.parent.postMessage is a cross-origin communication mechanism available in web browsers.
Register an event listener for the parent window containing the iframe to monitor for message events. Specifically, listen for a connect_webview.login_succeeded event. This event indicates that Seam has successfully established the connection to the user’s device or ACS account. A connect_webview.login_failed event indicates that the account connection did not complete successfully.
For example:
Additional Connection-Related Events
Once you have received aconnect_webview.login_succeeded event, you can use webhooks or listen for any of the following useful connection-related events:
| Event | Description |
|---|---|
connected_account.created | A connected account has been imported into your Seam workspace. |
connected_account.connected | Seam has established connection to or is reconnected to a connected account. |
connected_account.completed_first_sync | Seam has finished the first sync of a connected account, and the corresponding devices or systems are now available. |
device.added | A device was added to Seam or was re-added to Seam after having been removed. |
device.connected | The status of a device changed from offline to online. That is, the |

