Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Custom HTML API reference

This document describes the JavaScript API available to custom HTML content rendered inside the Circle Plus mobile app. Use these functions and objects to interact with the native app from your custom HTML screens.

Overview

When your custom HTML content is loaded inside the Circle mobile app, several JavaScript functions and objects are automatically injected into the window object. These allow you to:

  • Access information about the currently authenticated user

  • Navigate to other screens within the app

  • Open URLs through the app's navigation system

  • Send custom messages to the native app

All injected code is available immediately when your HTML loads - no additional setup required.


Global Objects

window.circleUser

An object containing information about the currently authenticated user.

Type: Object

Properties:

Property
Type
Description

name

string

User's full display name

email

string

User's email address

publicUid

string

User's unique public identifier

isAdmin

boolean

true if the user has admin privileges

isModerator

boolean

true if the user has moderator privileges

Example:


Navigates to another custom (orphaned/not in nav) screen within the app by its screen ID. This will "stop" the native navigation inside the webview.

Signature:

Parameters:

Parameter
Type
Required
Description

screenId

string

Yes

The unique identifier of the orphaned screen to navigate to

Returns: void

Example:

Notes:

  • The screen ID must correspond to an existing orphaned screen in your Circle community

  • Navigation is handled natively, providing smooth transitions


Opens a URL through the app's navigation system. The app will handle the URL appropriately based on its type (deep links, external URLs, etc.).

Signature:

Parameters:

Parameter
Type
Required
Description

url

string

Yes

The URL to navigate to

Returns: void

Example:

Notes:

  • Deep links to Circle content will navigate within the app

  • External URLs may open in an in-app browser or external browser depending on app configuration

Feature Detection

You can check if your HTML is running inside the Circle mobile app:


Callback Functions

The Circle mobile app provides callback functions that your custom HTML can call to notify the native app about specific events. These are particularly useful for signup flows, content creation, and payment processes.

window.webview.accountCreatedCallback()

Called when a user account is successfully created. This function notifies the native app and may clear cookies.

Signature:

Parameters:

Parameter
Type
Required
Description

data

object

Yes

Account creation data including email and profile information

Example:

Notes:

  • This function is typically available only on signup/registration screens

  • May automatically clear cookies after being called


window.webview.handleEmailAlreadyExistsError()

Handles the case when a user tries to sign up with an email that already exists. This modifies the error link behavior to communicate with the native app instead of navigating.

Signature:

Parameters: None

Example:

Notes:

  • This function modifies the DOM to intercept clicks on the existing account error link

  • Sends an error message to the native app instead of navigating

window.webview.onProfileInfoSaved()

Called when user profile information has been successfully saved. Triggers navigation back and shows a success notification.

Signature:

Parameters: None

Example:


window.webview.onEventPurchaseEnded()

Called when an event purchase flow is completed. Used in paywall screens.

Signature:

Parameters:

Parameter
Type
Required
Description

data.space_id

number

Yes

ID of the event's space

data.post_id

number

Yes

ID of the event post

data.redirect_url

string

Yes

URL to open after the purchase

data.success

boolean

Yes

Whether the purchase succeeded

Example:


window.webview.paymentSuccessful()

Called when a payment is successfully processed. Used in paywall and billing screens.

Signature:

Parameters:

Parameter
Type
Required
Description

data.redirect_url

string

Yes

URL to open after the payment

Example:


Theme and Appearance

window.webview.setAppearance()

A hook your page defines and the app calls. The app calls window.webview.setAppearance(mode) on your page when the theme changes. Define this function if your custom HTML supports light and dark themes. Calling it from your own code only runs your function; it won’t change the app’s theme.

Signature:

Parameters:

Parameter
Type
Description

appearance

string

The theme to show. Circle's own pages treat "dark" as dark mode and any other value as light mode.

Example:

Examples

Personalized Welcome Screen

Multi-Step Form Navigation

Conditional Content Based on User Role


Best Practices

1. Always Check for API Availability

2. Use Viewport Meta Tag

Include the viewport meta tag for proper mobile rendering:

3. Handle Missing User Data Gracefully

4. Test in Browser During Development

Create mock objects for browser testing but make sure to also test on your app, webviews can behave differently than a regular browser.

5. Use Mobile-Friendly Styles


API Summary

API
Type
Description

window.circleUser

Object

Current user information

window.circleUser.name

string

User's display name

window.circleUser.email

string

User's email

window.circleUser.publicUid

string

User's public ID

window.circleUser.isAdmin

boolean

Admin status

window.circleUser.isModerator

boolean

Moderator status

window.navigateToOrphanedScreen(screenId)

Function

Navigate to custom screen

window.navigateToUrl(url)

Function

Navigate to URL

window.ReactNativeWebView.postMessage(json)

Function

Send message to native app


Support

If you encounter issues with the Custom HTML API, please contact the Circle support team or your account administrator.

Last updated