# Intercom

> Connect Intercom so reviews see the customer impact of linked conversations and of open conversations tagged for a repository, with personal data removed.

When a pull request links to Intercom conversations, or open conversations carry a tag you map to its repository, MergeHarbor adds a short summary of what customers report to the review, with personal data removed.

## What it does in reviews

- **Finds the conversations a pull request refers to.** Conversation links on your connected workspace (`https://app.intercom.com/a/inbox/…/conversation/<id>` and `/a/apps/…` links) in the pull request title and description, and in the issues it links to.
- **Adds open conversations tagged for the repository.** For the tags you map to a repository, MergeHarbor counts the open conversations and reads the 5 latest.
- **Summarises the impact.** Each conversation becomes a few lines: title, state, priority, age, tags and the first lines of the customer's first message. No extra model call is made.

## Personal data is removed

Contacts, companies and teammates are never read. Every text is passed through PII redaction before it is cached or sent to a model: email addresses, phone numbers, card numbers, postal addresses, names in greetings and sign-offs, handles and links with query strings are removed, along with anything that looks like a secret.

## What is read and what is never read

- **Read:** the title, state, priority, tags, creation time and first message of linked conversations and of the 5 latest open conversations with a mapped tag; the workspace's tags; the workspace name.
- **Never read:** contacts, companies, teammates' replies, notes, attachments, articles, and conversations that are neither linked nor tagged. MergeHarbor never writes to Intercom.

Conversation summaries are cached for a short time (10 minutes by default), deleted within 24 hours, and never written to logs.

## Connect

1. In the console, open **Integrations** and choose **Connect** on **Intercom** (under **Customer support**). You need the `settings.manage` permission.
2. Sign in to Intercom and install MergeHarbor on your workspace. It asks only to read conversations, tags and admins.
3. Choose **Test connection**.

**With an access token instead.** In the Intercom Developer Hub, create an app for your workspace with only the read conversations, read tags and read admins permissions, and copy its access token. On the **Intercom** card, choose **Use an access token** and paste it.

## Map tags to repositories

Open **Settings** on the connection and add, for each repository, up to 10 Intercom tags. Choose **All repositories** to map tags to every repository the connection is allowed for. Without a mapping, reviews read only the conversations a pull request links to.

## Limits

- At most 3 linked conversations per review.
- At most the 5 latest open conversations with a mapped tag per review, plus their total count.
- Personal data is removed from every conversation before it is stored or used.

## Disconnect

Open the integration in **Integrations** and choose **Disconnect**. For a connection made by signing in, MergeHarbor uninstalls itself from the workspace; it then deletes its token and cached summaries. For an access token, delete the app in the Intercom Developer Hub.

## Self-hosted installations

Create an app in the Intercom Developer Hub (step by step in `docs/OAUTH_APPS.md`, "Intercom connections"): turn on OAuth with the redirect URL `{PUBLIC_URL}/integrations/connect/intercom/callback` and the read conversations, read tags and read admins permissions, then set `INTERCOM_OAUTH_CLIENT_ID` and `INTERCOM_OAUTH_CLIENT_SECRET`. Without the app, Intercom connects with an access token only.
