# Deep Links

> Open specific boards, community boards, components, screens, elements, and the sitemap scanner in the Chrome Extension via URL

Source: https://infa.ai/docs/deep-links

The Infa Chrome Extension supports deep linking, allowing you to open specific content directly from URLs, emails, documentation, or other web screens.

## URL Format

All deep links use the `/open` route on the Infa web app:

```
https://infa.ai/open?[parameters]
```

The parameters are the same ones the side panel writes into its own address (see [Side Panel URLs](#side-panel-urls)), so a side panel URL and a deep link name the same place.

## Side Panel Views

`view` names what the side panel shows. It is the main parameter of every deep link below.

| View         | What it shows                  | Its parameters                                   |
| ------------ | ------------------------------ | ------------------------------------------------ |
| `select`     | The Select tab                 | `url`, `xpath`: an element to select             |
| `components` | The Components tab             | `componentView`: a component view to highlight   |
| `tokens`     | The Design Tokens tab          |                                                  |
| `patterns`   | The Patterns tab               |                                                  |
| `comments`   | The Comments tab               | `threadId`, `replyId`: a comment to highlight    |
| `report`     | The Measure tab                |                                                  |
| `nav`        | The side navigation menu       |                                                  |
| `ai`         | The AI chat                    |                                                  |
| `screen`     | The screen editor              | `screenId`: the screen to edit (else a new one)  |
| `sitemap`    | The sitemap scanner            | `startingUrl`, `autoStartScan=1`                 |

Older spellings still work: `mode=` for `view=`, `inspect` for `select`, `action=screen`, `action=page` and `action=sitemap`. A link without `view` still opens the view its parameters imply: `url` + `xpath` → `select`, `componentView` → `components`, `screenId` → `screen`, `threadId` → `comments`.

## Supported Deep Links

### Open Board

Open a specific board in the Chrome Extension side panel, optionally navigating to a URL and showing a view.

**URL Format:**

```
https://infa.ai/open?board={boardId}&openUrl={encodedUrl}&view={view}
```

**Examples:**

```
# Basic - just open a board
https://infa.ai/open?board=b_9jypTUvD

# With URL navigation - navigate to a page, then open the board
https://infa.ai/open?board=b_9jypTUvD&openUrl=https%3A%2F%2Fexample.com

# With a view - open the board in report mode
https://infa.ai/open?board=b_9jypTUvD&view=report

# Full - navigate to URL, open board, and show report mode
https://infa.ai/open?board=b_9jypTUvD&openUrl=https%3A%2F%2Fexample.com&view=report
```

**Parameters:**

- `board` (required): The board ID (format: `b_*`)
- `openUrl` (optional): URL to navigate the current tab to before opening the board (URL-encoded)
- `view` (optional): The [side panel view](#side-panel-views) to show after opening the board (`mode` is the older name and still works)

**Behavior:**

1. Opens the Chrome Extension side panel
2. Navigates current tab to the specified URL (if `openUrl` provided)
3. Waits for page to fully load
4. Switches to the specified board
5. Shows the specified view (if `view` provided)

---

### Open a View

Show a side panel view on whatever board the side panel has open.

**URL Format:**

```
https://infa.ai/open?view={view}
```

**Examples:**

```
https://infa.ai/open?view=components
https://infa.ai/open?view=nav
```

**Parameters:**

- `view` (required): The [side panel view](#side-panel-views) to show, with its parameters

**Behavior:**

1. Opens the Chrome Extension side panel
2. Shows the view, without switching boards

---

### Open Community Board

Open a community board directly in the Chrome Extension using the community handle and board URL handle.

**URL Format:**

```
https://infa.ai/open?community={handle}/{boardHandle}
```

**Example:**

```
https://infa.ai/open?community=infa/primer
```

**Parameters:**

- `community` (required): The community identifier in format `{handle}/{boardHandle}`
    - `handle`: The community profile handle (e.g., "infa")
    - `boardHandle`: The board's URL handle (e.g., "primer", "design-system")

**Behavior:**

1. Opens the Chrome Extension side panel
2. Fetches the community board data from the database
3. Loads the community board from the retrieved file route
4. Displays the board's components

**Note:**

- Community boards do not require authentication
- The system automatically looks up the board's file route from the database
- You can find community boards at `https://infa.ai/in/{handle}/{boardHandle}`
- You can also use the dedicated "Open Community Board" button on community board screens

---

### Open Component View

Open a specific component view within a board and highlight it.

**URL Format:**

```
https://infa.ai/open?board={boardId}&componentView={componentViewId}
```

**Example:**

```
https://infa.ai/open?board=b_9jypTUvD&componentView=cv_whCWEPTl
```

**Parameters:**

- `board` (required): The board ID (format: `b_*`)
- `componentView` (required): The component view ID (format: `cv_*`)

**Behavior:**

1. Opens the Chrome Extension side panel
2. Switches to the specified board
3. Switches toolbar to "Components" mode
4. Highlights the specified component view
5. Scrolls the component into view

**Fallback for Inaccessible Components:**

If the component's page is not accessible (requires login, different domain, etc.), the extension shows a notification with a "View Anyway" button that:

1. Navigates to the component's page
2. Switches to the Select tab
3. Displays the component screenshot

---

### Open Element (XPath)

Open a specific DOM element on a page using its XPath.

**URL Format:**

```
https://infa.ai/open?url={encodedUrl}&xpath={encodedXpath}
```

**Example:**

```
https://infa.ai/open?url=https%3A%2F%2Fexample.com&xpath=%2F%2Fbutton
```

**Parameters:**

- `url` (required): The page URL (URL-encoded)
- `xpath` (required): The XPath to the element (URL-encoded)

**Behavior:**

1. Opens the Chrome Extension side panel
2. If not already on the page, navigates to the specified URL
3. Switches to the Select tab
4. Selects and highlights the element
5. Scrolls the element into view

**Error Handling:**

- If the element is not found, shows an error notification
- If navigation fails, shows an error notification

---

### Open the Screen Editor

Open the screen editor for a specific screen within a board. This allows users to directly edit screen details (title, URL pattern, variables) from a deep link.

**URL Format:**

```
https://infa.ai/open?board={boardId}&view=screen&screenId={screenId}
```

**Example:**

```
https://infa.ai/open?board=b_9jypTUvD&view=screen&screenId=s_tAhQdRsu
```

**Parameters:**

- `board` (required): The board ID (format: `b_*`)
- `view` (optional): `screen`. Older links use `action=screen` or `action=page`, which still work; a `screenId` alone implies it
- `screenId` (optional): The screen ID to edit (format: `s_*`). Without it the editor opens to create a new screen

**Behavior:**

1. Opens the Chrome Extension side panel
2. Switches to the specified board (if not already selected)
3. Fetches the screen data from the server
4. Opens the screen editor with the screen's current data pre-filled
5. User can edit the screen title, URL pattern, and variables

**Use Cases:**

- Email notifications linking directly to a screen that needs review
- Documentation linking to specific screen configurations
- Automated workflows that need users to update screen settings

**Error Handling:**

- If the board is not found or inaccessible, shows an error notification
- If the screen is not found within the board, shows an empty editor

---

### Open Comment

Open a comment thread (optionally a reply in it) on a board, in the Comments tab.

**URL Format:**

```
https://infa.ai/open?board={boardId}&threadId={threadId}&replyId={replyId}
```

**Parameters:**

- `board` (required): The board ID (format: `b_*`)
- `threadId` (required): The comment thread to highlight
- `replyId` (optional): A reply within the thread to highlight

**Behavior:**

1. Opens the Chrome Extension side panel
2. Switches to the specified board
3. Switches to the Comments tab
4. Scrolls to and highlights the thread or reply

---

### Open Sitemap Scanner

Open the Sitemap Scanner modal for a board, optionally pre-filling a starting URL and auto-starting the scan.

**URL Format:**

```
https://infa.ai/open?board={boardId}&view=sitemap&startingUrl={encodedUrl}&autoStartScan=1
```

**Examples:**

```
# Open sitemap scanner for a board
https://infa.ai/open?board=b_9jypTUvD&view=sitemap

# Pre-fill starting URL
https://infa.ai/open?board=b_9jypTUvD&view=sitemap&startingUrl=https%3A%2F%2Fexample.com

# Pre-fill URL and auto-start scan
https://infa.ai/open?board=b_9jypTUvD&view=sitemap&startingUrl=https%3A%2F%2Fexample.com&autoStartScan=1
```

**Parameters:**

- `board` (required): The board ID (format: `b_*`)
- `view` (required): `sitemap` (`action=sitemap` is the older form and still works)
- `startingUrl` (optional): URL to pre-fill in the scanner input (URL-encoded)
- `autoStartScan` (optional): Set to `1` to automatically start scanning after the modal opens

**Behavior:**

1. Opens the Chrome Extension side panel
2. Switches to the specified board
3. Opens the Sitemap Scanner modal
4. Pre-fills the starting URL (if `startingUrl` provided)
5. Automatically starts the scan (if `autoStartScan=1`)

**Use Cases:**

- Canvas toolbar "Scan sitemap" button for quick page discovery
- Sharing a scannable sitemap link in documentation or team chat
- Automated workflows that need to populate a board's page hierarchy

---

## Authentication

Deep links work for both authenticated and unauthenticated users:

### Authenticated Users

- Can access private boards
- Can open components from authenticated screens
- Credentials are automatically passed to the extension

### Unauthenticated Users

- Can access public boards and community boards
- Cannot access private boards (shows error notification)
- Cannot access components requiring authentication

---

## Usage Examples

### From Email or Documentation

```html
<a href="https://infa.ai/open?board=b_9jypTUvD">Open Design System Board</a>
<a href="https://infa.ai/open?community=infa/primer"
    >Open Infa Primer Community Board</a
>
<a href="https://infa.ai/open?board=b_9jypTUvD&view=screen&screenId=s_tAhQdRsu"
    >Edit Landing Screen Settings</a
>
<a
    href="https://infa.ai/open?board=b_9jypTUvD&view=sitemap&startingUrl=https%3A%2F%2Fexample.com"
    >Scan Sitemap</a
>
```

### From JavaScript

```javascript
// Open board
window.open("https://infa.ai/open?board=b_9jypTUvD", "_blank");

// Open community board
window.open("https://infa.ai/open?community=infa/primer", "_blank");

// Open component view
window.open(
    "https://infa.ai/open?board=b_9jypTUvD&componentView=cv_whCWEPTl",
    "_blank",
);

// Open the screen editor
window.open(
    "https://infa.ai/open?board=b_9jypTUvD&view=screen&screenId=s_tAhQdRsu",
    "_blank",
);

// Open sitemap scanner
window.open(
    "https://infa.ai/open?board=b_9jypTUvD&view=sitemap&startingUrl=https%3A%2F%2Fexample.com&autoStartScan=1",
    "_blank",
);

// Open element
const url = encodeURIComponent("https://example.com");
const xpath = encodeURIComponent('//button[@class="primary"]');
window.open(`https://infa.ai/open?url=${url}&xpath=${xpath}`, "_blank");
```

### From Markdown

```markdown
[View Button Component](https://infa.ai/open?board=b_9jypTUvD&componentView=cv_whCWEPTl)
[Open Infa Primer Board](https://infa.ai/open?community=infa/primer)
[Edit Landing Screen](https://infa.ai/open?board=b_9jypTUvD&view=screen&screenId=s_tAhQdRsu)
[Scan Sitemap](https://infa.ai/open?board=b_9jypTUvD&view=sitemap&startingUrl=https%3A%2F%2Fexample.com)
```

---

## Cold Start vs Warm Start

### Warm Start

If the Chrome Extension side panel is already open, the deep link:

- Reuses the existing side panel
- Faster response time
- Smoother user experience

### Cold Start

If the Chrome Extension side panel is closed, the deep link:

- Opens a new side panel
- Slightly longer response time
- Still provides full functionality

---

## Side Panel URLs

The side panel keeps its own address in step with what it shows:

```
chrome-extension://{extensionId}/sidepanel.html?view=components
```

As you switch tabs or open the side nav, the screen editor, the sitemap scanner or the AI chat, `view` changes with it. It is the view in front and nothing else: no board or item ids, so each view has one URL. Two things follow:

- **Captures tell side panel views apart.** Saving the side panel with Infa Capture's "Save screen" records `sidepanel.html?view=components`, `…?view=nav` and so on, so each view becomes its own screen on the board.
- **A side panel URL is a link.** Loading `sidepanel.html?view=…` opens that view, and a reload keeps it. The same query works as a deep link: `sidepanel.html?view=nav` is `https://infa.ai/open?view=nav`.

## How It Works

One module defines the parameters: `src/utils/sidePanelLocation.ts` in the web app, which the extension imports as `infa-app/sidePanelLocation`. It reads every form a link has taken (`view`, `mode`, `action`, implied views) and writes one canonical query string, `view` first.

1. `/open` reads the link with it and sends the extension one message: `openBoard`, `openComponent`, `openElement`, `openComment`, `openScreenModal` (still sent under its older name, `openPageModal`), `openCommunityBoard`, or `openView` for a view without a board.
2. For `openView`, and for the side nav, AI chat and screen editor views of `openBoard`, the background hands the side panel a query string.
3. The side panel applies that query string with the same code that applies its own `?view=` when it loads.

---

## Error Handling

### Common Errors

| Error                        | Cause                                   | Solution                             |
| ---------------------------- | --------------------------------------- | ------------------------------------ |
| "Extension is not installed" | Chrome Extension not installed          | Install from Chrome Web Store        |
| "Board Not Found"            | Invalid board ID or no access           | Verify board ID and authentication   |
| "Community board not found"  | Invalid file route or board unavailable | Verify the file route URL is correct |
| "Component view not found"   | Invalid component view ID               | Verify component view ID             |
| "Page not found"             | Invalid page ID or page not in board    | Verify page ID belongs to the board  |
| "Element not found"          | Invalid XPath or element removed        | Verify XPath is correct              |
| "Failed to navigate"         | Invalid URL or network error            | Check URL and internet connection    |

### Retry Behavior

The system automatically retries failed operations:

- **5 retries** with 1-second intervals
- Exponential backoff for network errors
- Clear error messages for non-retryable errors

---

## Limitations

1. **Chrome Browser Only**: Deep links require Chrome browser (not Firefox, Safari, etc.)
2. **Extension Required**: User must have the Infa Chrome Extension installed
3. **Same-Origin Policy**: Some screens may block element selection due to security policies
4. **Authentication**: Private content requires user authentication (community boards are public and don't require authentication)

---

## Security Considerations

### Origin Validation

- External deep links only accepted from authorized domains
- Internal deep links validated against user permissions

### Parameter Sanitization

- All parameters are validated and sanitized
- XPath injection prevention
- SQL injection prevention for database queries

### Authentication

- Token validation for protected resources
- Permission checking for sensitive operations
- Session management for multi-step operations
