---
title: "Show your own data in the ticket sidebar"
description: "Build a sidebar app: your endpoint returns the customer's data and actions, and Gleap shows them next to tickets, contacts and companies."
url: https://help.gleap.ai/en/articles/367-show-your-own-data-in-the-ticket-sidebar
collection: "Developer guides"
updated: 2026-11-03
language: en
---

# Show your own data in the ticket sidebar

Build a sidebar app: your endpoint returns the customer's data and actions, and Gleap shows them next to tickets, contacts and companies.

A sidebar app is a panel in the ticket sidebar whose contents come from your backend. The dashboard calls your endpoint with the context of the conversation, and you return what should be shown. It's how an agent sees the customer's subscription, their last order or their account state from your own system without leaving the ticket, and acts on it without opening your admin tool. Only project admins can set one up.

### Set one up

1.  Go to **Settings → Developer → Sidebar apps** and click **Add app**. The **New app** dialog opens.
    
2.  Enter the **App name**: the panel heading your agents see.
    
3.  Enter the **API URL** of your endpoint.
    
4.  Add **Headers** sent with every request, usually an `Authorization` header so you can tell the call really comes from your dashboard.
    
5.  Choose where it shows: **Conversations**, **Contacts** and **Companies**. New apps start with Conversations and Contacts on, and at least one must stay on.
    
6.  Under Conversations, turn on **Exclude messages from payload** unless your endpoint genuinely needs the conversation. It keeps the ticket and its messages out of the request, and makes the payload smaller.
    
7.  Click **Create app**.
    

You can add several apps; each one renders as its own panel. Open a ticket to check it: the panel loads with what your endpoint returned.

![Sidebar apps screen in the Pied Piper demo project.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/wC99D6vHvpheDtVFGRSZiJg8xPnRIRGHrEjJD6VXu98Yv4rXD2cBHTTyhHbTeIZnXK1c7C94l2p.png)

### The request Gleap sends

When a ticket opens, the agent's browser makes a `POST` to your API URL with your headers and `Content-Type: application/json`. Because the call comes from the browser, your endpoint has to accept cross-origin requests (CORS) from the dashboard, and your headers are visible to anyone on your team who inspects the request. While the ticket stays open, new activity refreshes the panel at most every five seconds. For a conversation, the body carries:

-   `surface`: `TICKET`, `CONTACT` or `COMPANY`, so one endpoint can serve every view
    
-   `session`: the contact, with `name`, `email`, `userId` and `customData`
    
-   `ticketId` and `ticket`: the conversation. `ticket` is left out when **Exclude messages from payload** is on
    
-   `user`: the teammate looking at the panel, not the customer
    
-   `company`: the contact's company, when it has one
    

```json
{
  "surface": "TICKET",
  "user": {
    "email": "anna@yourcompany.com",
    "firstName": "Anna",
    "lastName": "Lee"
  },
  "session": {
    "name": "Max Smith",
    "email": "max@acme.com",
    "userId": "A-1042",
    "customData": {
      "plan": "pro"
    }
  },
  "ticketId": "6a7c…",
  "ticket": {
    "id": "6a7c…",
    "status": "OPEN"
  }
}
```

On a contact page the body has the same keys without `ticketId` and `ticket`. On a company page it carries only `surface`, `user` and `company`.

Authenticate the call with the header you set, then key off the contact's email, or the user ID you passed at identification, to fetch their record.

### What you return

Respond with a `2xx` status and a JSON object whose `content` is a list of items:

<table style="min-width: 50px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p>Type</p></th><th colspan="1" rowspan="1"><p>What it shows</p></th></tr><tr><td colspan="1" rowspan="1"><p><code>text</code></p></td><td colspan="1" rowspan="1"><p>A line of text, in <code>text</code>.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>key-value</code></p></td><td colspan="1" rowspan="1"><p>Label and value pairs in <code>keyValue</code>, each with a <code>key</code> and a <code>value</code>. The workhorse for account data.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>image</code></p></td><td colspan="1" rowspan="1"><p>An image, by URL in <code>image</code>.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>button</code></p></td><td colspan="1" rowspan="1"><p>An action, in <code>button</code> (see below).</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>form</code></p></td><td colspan="1" rowspan="1"><p>Fields the agent fills in and submits back to you, in <code>form</code>.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>html</code></p></td><td colspan="1" rowspan="1"><p>Raw HTML in <code>html</code>, for anything the other types can't express.</p></td></tr></tbody></table>

```json
{
  "content": [
    { "type": "text", "text": "Pro plan · renews 12 Mar 2026" },
    {
      "type": "key-value",
      "keyValue": [
        { "key": "MRR", "value": "$49" },
        { "key": "Status", "value": "Active" }
      ]
    },
    { "type": "image", "image": "https://acme.com/avatar/1042.png" }
  ]
}
```

Prefer `key-value` over `html` where you can. It inherits Gleap's styling, so it keeps looking right when the dashboard changes. HTML is inserted into the dashboard as it is, without sanitising, so only return markup you control. Items of any other type are not shown.

### Add a button

A button either opens a URL or makes an HTTP request back to you, with a method, headers and body you define, and success and error messages the agent sees. On a `POST`, the body also carries the same context your API URL received, unless you set `includeContext` to `false`. That's the difference between a sidebar that shows a subscription and one that can extend a trial.

```json
{
  "type": "button",
  "button": {
    "label": "Extend trial 14 days",
    "action": "http-request",
    "url": "https://acme.com/gleap/extend",
    "method": "POST",
    "headers": [{ "key": "Authorization", "value": "Bearer …" }],
    "body": { "accountId": "A-1042", "days": 14 },
    "successMessage": "Trial extended to 26 Mar.",
    "errorMessage": "Couldn't extend. Do it from the admin tool."
  }
}
```

For a plain link, set `action` to `open-url` or leave it out: the button opens its `url` in a new tab.

### Add a form

A form takes it further: `text`, `textarea`, `select`, `radio`, `checkbox`, `number` and `date` fields, submitted to the `url` you specify. Each field has a `name`, and the values arrive at your endpoint under `formData`. Use it when the action needs input, like a refund amount or a reason code.

```json
{
  "type": "form",
  "form": {
    "url": "https://acme.com/gleap/refund",
    "submitLabel": "Refund",
    "fields": [
      { "type": "number", "name": "amount", "label": "Refund amount", "required": true },
      {
        "type": "select",
        "name": "reason",
        "label": "Reason",
        "options": [
          { "label": "Duplicate", "value": "duplicate" },
          { "label": "Faulty", "value": "faulty" },
          { "label": "Goodwill", "value": "goodwill" }
        ]
      }
    ]
  }
}
```

> **Warning:** Anything you expose here, any teammate who can open that ticket can do, and the request runs from their browser. Put destructive operations behind a confirmation in your own system, or don't expose them at all.

### Practical advice

Keep it fast. The panel loads when the ticket opens, so a slow endpoint is felt on every single conversation. Cache on your side rather than querying three systems per request.

Handle "not found" gracefully. Plenty of contacts won't exist in your system, and a short "no account" line reads better than an empty panel or an error.

Show what changes the answer, like plan, status and last invoice, not everything you have. A sidebar with thirty fields gets scrolled past.

### Related

-   [Show your own data in the messenger](https://help.gleap.ai/en/articles/276-show-your-own-data-in-the-messenger.md)
    
-   [Connect Stripe](https://help.gleap.ai/en/articles/352-connect-stripe.md)
    
-   [Identify users and send attributes and events](https://help.gleap.ai/en/articles/230-identify-users-and-send-attributes-and-events.md)
