Integrations
A guide to integrating your services and web apps with the Runtime SDK.
Anon’s Runtime SDKs run in multiple contexts, and are designed to be as flexible as possible. This guide will walk you through the process of integrating the SDK into your backend, web apps, and/or mobile apps.
The core of the SDKs is a type-safe REST client, combined with a set of utility functions for handling sessions in various browser runtimes.
Integrating the Runtime SDK
To get started, add the SDK to your project’s dependencies.
These SDKs are not published to public package registries at this time, so please head here to get access. We’ll give you an access token that you can use to connect to Anon’s private package registries for NPM, PyPI, and more.
Create a .npmrc
file in the same directory as your package.json
and have it contain the following snippet. Replace NPM_TOKEN
with your auth token received from Anon.
@anon:registry=https://npm.cloudsmith.io/anon/anon-sdk/
//npm.cloudsmith.io/anon/anon-sdk/:_authToken=NPM_TOKEN
@npm:registry=https://registry.npmjs.org/
Once you’ve added the SDK to your dependencies, you can import and configure the Anon Client
to start using sessions.
You’ll need to have your API Key
secret handy for this step.
Use environment variables to pass your API Key
secret into your Client
configuration. Don’t store your secret as plaintext in your codebase.
That’s it! You’re ready to start using sessions.
Running Automations for your integration
The following format may be used for any of our supported apps.
import { runInBrowser } from '@anon/sdk-typescript';
import { Page } from 'playwright';
await runInBrowser({
account: {
app: "<appName>",
userId: 'user_1234'
},
url: https://www.<appName>.com,
headless: false,
script: async ( page: Page ) => {
// Now you're ready to perform actions on the user's behalf using a logged in playwright instance.
// Confirm action
await page.goto("https://www.<appName>.com");
// Your automation code here!
}
})
Was this page helpful?