Skip to main content

TS/JS SDK Overview

Contributions are welcome at https://github.com/CloudCruise/cloudcruise-js. Report bugs via GitHub issues or Discord. The CloudCruise TypeScript/JavaScript SDK provides a simple way to integrate browser automation workflows into your applications. Execute workflows, manage credentials, and monitor runs programmatically.

Installation

Install the latest version:
Get your keys at CloudCruise Settings.

1. Creating a Run

2. Listening to run events

Use typed per-event listeners for the best DX. Alternatively, you can attach a single 'run.event' listener and switch on message.data.event.

Other available events

  • ‘open’: connection established
  • ‘ping’: heartbeat messages
  • ‘reconnect’: reconnect attempts with { attemptDelayMs }
  • ‘message’: catch-all mirror of 'run.event' and 'ping'
  • ‘close’: connection closed (informational)
  • ‘error’: SSE errors
  • ‘end’: terminal status for the session
Example:

Async iteration (streaming)

If you prefer a loop:
  • Tip: Use Option A for strongly-typed handlers when you know the events you care about. Use Option B for centralized routing/logging. Both can be combined (e.g., typed listeners for your primary events plus a catch-all logger).

3. Wait for Completion

You can wait for the run to finish, but keep in mind if your run is long, this can be a very long time:

Watching a Live Session

While a session is running, fetch a viewer URL to watch its browser stream:
The auth token embedded in url is single-use — reopening a previously used viewer link (reloading the tab, or opening it later) fails to connect. Call getLiveViewConnection again to mint a fresh link instead of reusing the old one. This only works while the session is still active.

Next Steps

  • Explore the Run API for detailed workflow execution options
  • Learn about Vault API for secure credential management
  • Check out Workflow API to manage your workflows
  • Set up Webhooks for event notifications