Retrieving Devices or Access Control Systems Connected Through a Connect Webview

Learn how to retrieve the set of devices or ACS that your app user connected to Seam through a specific Connect Webview.

When your app user completes a Connect Webview authorization flow successfully, the resulting connected_account.connected eventarrow-up-right includes a connected_account_id. Also, once the connection is successful, the connect_webview objectarrow-up-right includes the connected_account_id.

The first step in controlling connected devices or a connected ACS is to retrieve the newly-connected set of devices or ACS.


Retrieve Connected Devices

Use this connected_account_id in a List Devicesarrow-up-right command to retrieve the devices that your user has just connected to Seam.

circle-info

If you set wait_for_device_creation to false when creating the Connect Webview, you should wait for the connected_account.completed_first_sync eventarrow-up-right before retrieving the user's devices. This event indicates that Seam has finished the first sync of the connected account and the devices are now available.

Code:

// Retrieve all devices for the connected_account_id.
const connectedDevices = await seam.devices.list({
  connected_account_id: "11111111-1111-1111-1111-222222222222"
});

Output:

[
  {
    connected_account_id: '11111111-1111-1111-1111-222222222222',
    device_id: '11111111-1111-1111-1111-444444444444',
    display_name: 'Front Door Lock',
    is_managed: true,
    ...
  },
  ...
]

Retrieve a Connected Access Control System

Use this connected_account_id in a List ACS Systemsarrow-up-right command to retrieve the ACS that your user has just connected to Seam.

circle-info

If you set wait_for_device_creation to false when creating the Connect Webview, you should wait for the connected_account.completed_first_sync eventarrow-up-right before retrieving the user's ACS. This event indicates that Seam has finished the first sync of the connected account and the acs_system is now available.

Code:

Output:

Last updated

Was this helpful?