Wait for the Connect Webview status to change to authorized, indicating that the connection was successful. You can either poll the Connect Webview or use webhooks to be notified when the status changes.
import { Seam } from 'seam'const seam = new Seam()// Poll until authorizedconst webview = await seam.connectWebviews.get({ connect_webview_id: webview.connect_webview_id,})if (webview.status === 'authorized') { console.log('Connection successful!') console.log(`Connected account ID: ${webview.connected_account_id}`)}
Once the connection is authorized, retrieve the list of Ultraloq devices associated with the connected account.
import { Seam } from 'seam'const seam = new Seam()const devices = await seam.devices.list({ connected_account_id: webview.connected_account_id,})for (const device of devices) { console.log(`Device: ${device.properties.name}`) console.log(`Device ID: ${device.device_id}`) console.log(`Warnings:`, device.warnings) console.log()}
Expected Output:When you first list Ultraloq devices, they will have the ultraloq_time_zone_unknown warning:
{ "device_id": "11111111-2222-3333-4444-555555555555", "device_type": "ultraloq_lock", "can_program_online_access_codes": true, "can_remotely_lock": true, "can_remotely_unlock": true, "warnings": [ { "warning_code": "ultraloq_time_zone_unknown", "message": "Seam does not know the time zone of the Ultraloq device. Set a time zone to enable time-bound access codes." } ], "properties": { "ultraloq_metadata": { "time_zone": null } }}
Important: The ultraloq_time_zone_unknown warning indicates that you
must configure the device’s timezone before creating time-bound access codes.
Proceed to Step 5 to configure timezones.
This is a required step for Ultraloq devices. You must configure each device’s timezone before you can create time-bound access codes.
import { Seam } from 'seam'const seam = new Seam()// Configure timezone for one or more devicesawait seam.devices.reportProviderMetadata({ devices: [ { device_id: device.device_id, ultraloq_metadata: { time_zone: 'America/New_York', }, }, ],})console.log('Timezone configured successfully!')
Valid Timezone Values: Use IANA timezone strings such as "America/New_York", "Europe/London", or "Asia/Tokyo". Do not use timezone abbreviations like "EST" or "PST".For a complete list of valid timezones, see the IANA Time Zone Database.
After configuring the timezone, verify that the warning has been cleared and the timezone is set correctly.
import { Seam } from 'seam'const seam = new Seam()const device = await seam.devices.get({ device_id: device.device_id,})// Check that timezone is configuredconsole.assert( device.properties.ultraloq_metadata.time_zone === 'America/New_York', 'Timezone should be set',)// Check that warning is clearedconst hasWarning = device.warnings.some( (w) => w.warning_code === 'ultraloq_time_zone_unknown',)console.assert(!hasWarning, 'Timezone warning should be cleared')console.log('✓ Device is ready to create time-bound access codes!')