# Customer Support Copilot

{% hint style="info" %}
The Customer Support Copilot is in Early Access. To request access, contact [support@pixiebrix.com ](mailto:support@pixiebrix.com)or your account executive.
{% endhint %}

PixieBrix's Customer Support Copilot provides a Heads-Up Display (HUD) and Chat Interface to breeze through your toughest support cases.

### Configuring a Customer Support Copilot

* Name: the name of the Customer Support Copilot
* Description: a description for the Customer Support Copilot
* System Prompt: additional instructions to pass to the AI. For example, context about your company, product lines, etc.
* Brand Guidelines: brand guidelines to follow when generating responses. For example, "Always be professional and empathetic".

#### Intents

Intents, also known as "call drivers", are the reason for contacting the brand. For example, "Upgrade Plan", "Password Reset", etc.

Intent Resources:

* Ticket Properties: properties/attributes to automatically extract from the ticket. For example: the name of the product the customer is inquiring about
* Article Links: links to internal/external articles
* Application Links: links to applications, e.g., product telemetry or error telemetry
* Response Templates: text response templates to insert into the conversation
* Chat Prompts: prompts to start a conversation in the [ai-chat-copilot](https://docs.pixiebrix.com/developing-mods/developer-concepts/types-of-mods/ai-chat-copilot "mention")

### Extending the Customer Support Copilot

#### Registering Custom Ticket Providers

Ticket Providers provide tickets (also known as cases) and conversations to the Customer Support Copilot. To make a ticket available to the Customer Support Copilot, use the `Upsert Customer Support Ticket Context` brick:

* Id: the unique identifier for the ticket
* Name: A user-facing name/title for the ticket, e.g., '#123: Password Reset Request'
* URL: The URL to open the ticket in the support system, e.g., a Zendesk URL. If not provided, defaults to the current URL.
* Requester: The display name of the user who requested the ticket, e.g., email or username
* Comments: the array of comments/internal notes:
  * Author: The author display name, e.g., email or username
  * Created At: The ISO 8601 timestamp when the comment was created
  * Body: The body/content of the comment
  * Public (Optional): true if the comment is visible to the requester/customer, or false for internal notes. Defaults to Public if not provided

#### Registering Custom Search Providers

The Customer Support Copilot uses search providers to automatically search for links related to the ticket. To register a custom search providers, use the `Add Support Copilot Search Provider` brick:

* Name: the name of the search provider
* Parameters: the JSON Schema for the search provider parameters.&#x20;
* Handle: The handler to run producing an array of search results (see type below). The validated arguments are provided to the handlers as `@args`

```typescript
type SearchResult = {
  /** User-facing title of the search result */
  title: string;

  /** External URL of the search result */  
  url: string;
  
  /** Optional preview snippet */
  snippet?: string;
}
```

#### Registering a User Resolver

A User Resolver searches a query (e.g., id, name, email) for users in your system/application.&#x20;

The Support Copilot uses the registered User Resolver to resolve:

* Text you search in the User HUD
* Text you select/search on the page

{% hint style="warning" %}
The User Resolver(s) should resolve to entities in your system/application, not associated entities (e.g., the associated entity in your Product Analytics tool)
{% endhint %}

To register a User Resolver, use the `Add User Resolver`  brick:

* Name: a unique name for the User Resolver, e.g., "My Service"
* Handler: the handler that returns a list of Users for the query

```typescript
type Args = {
  /** The user query */
  query: string;
}

type User = {
  /** The user identifier, e.g., UUID, email, etc. */
  id: string;
  
  /** Email address */
  email: string;
  
  /** Full name */
  name?: string;
}
```

**API Integration Reference**

* [Clerk](https://clerk.com/docs/reference/backend-api/tag/users/get/users)
* [Firebase](https://firebase.google.com/docs/auth/admin/manage-users#retrieve_user_data)&#x20;

#### Registering User Property Providers

The Customer Support Copilot calls User Property Providers to provide information about a user in your system/application. For example, current plan, date joined, etc.

To register a User Property Provider, use the `Add User Property Provider` brick:

* Name: a unique the name for provider. Displayed in the User HUD UI. For example, the data source, e.g., Salesforce, PostHog
* Handle: The handler to run producing an object/dictionary of properties

#### Registering User Actions

To register a User Action, use the `Add User Action` brick:

* Name: a name/title for the action
* Icon: an icon for the action
* Variant: the UI variant of the action. One of: primary, secondary, info, success, warning, danger, link
* Handle: The action handler
