---
title: "Intercom · Nuxt Scripts"
description: "Load Intercom through a typed command queue or a click-triggered custom launcher."
canonical_url: "https://scripts.nuxt.com/scripts/intercom"
meta:
  "og:description": "Load Intercom through a typed command queue or a click-triggered custom launcher."
  "og:image": "https://scripts.nuxt.com/_og/s/o_9370510dc30f2feb.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Intercom · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/s/o_9370510dc30f2feb.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Scripts**

# **Intercom**

[Copy for LLMs](https://scripts.nuxt.com/scripts/intercom.md)

[**Intercom**](https://www.intercom.com/) provides an in-app messenger for customer conversations.

Use [`**useScriptIntercom()**`](#usescriptintercom) for direct API calls, or [`**<ScriptIntercom>**`](#scriptintercom) for a custom messenger launcher.

**Intercom**

[**View source **](https://github.com/nuxt/scripts/blob/main/packages/script/src/runtime/registry/intercom.ts)

## Nuxt Config Setup

Add this to your `**nuxt.config.ts**` to load Intercom globally. Alternatively you can use the **useScriptIntercom** composable for more control.

```
export default defineNuxtConfig({
  scripts: {
    registry: {
      intercom: {
        app_id: 'YOUR_APP_ID',
        trigger: 'onNuxtReady',
      }
    }
  }
})
```

This config automatically enables **first-party mode ** (bundle + proxy). See below to customise.

## useScriptIntercom()

The `**useScriptIntercom**` composable lets you have fine-grain control over when and how Intercom is loaded on your site.

```
const { proxy } = useScriptIntercom()

proxy.Intercom('show')
```

Please follow the [**Registry Scripts **](https://scripts.nuxt.com/docs/guides/registry-scripts) guide to learn more about advanced usage.

## First-Party Mode: Privacy Focused Proxy

No extra config needed. The script is bundled from your domain (faster loads, no extra DNS lookup) and runtime requests are reverse-proxied through your server with automatic anonymisation (user IPs stay hidden from Intercom, works with ad blockers). [**Learn more. **](https://scripts.nuxt.com/docs/guides/first-party)

**Mode**

Bundle Proxy

**Privacy**

User IP addresses are anonymised. Other request data passes through.

```
export default defineNuxtConfig({
  scripts: {
    // ✅ First-party mode: bundled + proxied
    registry: {
      intercom: {
        app_id: 'YOUR_APP_ID',
        trigger: 'onNuxtReady',
      },
    },
  },
})
```

## Example

Using Intercom in a component with the proxy to send events .

ConversionButton.vue

```
<script setup lang="ts">
const { proxy } = useScriptIntercom()

// noop in development, ssr
// just works in production, client
function handleAction() {
  proxy.Intercom('show')
}
</script>

<template>
  <div>
    <button @click="handleAction">
      Send Event
    </button>
  </div>
</template>
```

## [`**<ScriptIntercom>**`](https://scripts.nuxt.com/scripts/intercom)

The headless facade holds back Intercom until its [**element trigger**](https://scripts.nuxt.com/docs/guides/script-triggers#element-event-triggers) fires. It listens for `**click**` by default.

### Demo

**Click to load**

Clicking the button to the right will load the Intercom script

### Component API

See the [**Facade Component API**](https://scripts.nuxt.com/docs/guides/facade-components#facade-components-api) for full props, events, and slots.

The component's `**api-base**` prop currently forwards `**app_base**`, but Intercom expects [`**api_base**`](https://developers.intercom.com/installing-intercom/web/installation). Until that mapping changes, the prop cannot select the EU or Australian data host. Use the composable directly when you need a regional endpoint:

```ts
useScriptIntercom({
  app_id: 'YOUR_APP_ID',
  api_base: 'https://api-iam.eu.intercom.io',
})
```

#### **With environment variables**

After you enable the registry entry, the module creates its public runtime-config fields. Set the app ID without adding a separate `**runtimeConfig**` block:

nuxt.config.ts

```ts
export default defineNuxtConfig({
  scripts: {
    registry: {
      intercom: { trigger: 'onNuxtReady' },
    }
  },
})
```

.env

```text
NUXT_PUBLIC_SCRIPTS_INTERCOM_APP_ID=<YOUR_APP_ID>
```

### Events

The [`**<ScriptIntercom>**`](https://scripts.nuxt.com/scripts/intercom) component emits `**ready**` after it mounts the messenger and `**error**` if the script fails to load.

```ts
const emits = defineEmits<{
  ready: [intercom: ReturnType<typeof useScriptIntercom>]
  error: []
}>()
```

```vue
<script setup lang="ts">
function onReady(intercom) {
  console.log('Intercom is ready', intercom)
}
</script>

<template>
  <ScriptIntercom app-id="YOUR_APP_ID" @ready="onReady" />
</template>
```

### Intercom API

The component exposes its `**intercom**` instance, which is the return value of `**useScriptIntercom()**`. Call the [**Intercom JavaScript API**](https://developers.intercom.com/installing-intercom/web/methods) through its proxy:

```vue
<script setup lang="ts">
const intercomEl = ref()

function showMessenger() {
  intercomEl.value?.intercom.proxy.Intercom('show')
}
</script>

<template>
  <ScriptIntercom ref="intercomEl" app-id="YOUR_APP_ID" trigger="immediate" />
  <button @click="showMessenger">
    Open chat
  </button>
</template>
```

### Slots

Use the slots to build the launcher and its loading states.

**default**

The default slot displays content while the facade is visible.

**awaitingLoad**

This slot displays content while Intercom waits for its configured trigger.

```vue
<template>
  <ScriptIntercom app-id="YOUR_APP_ID">
    <template #awaitingLoad>
      <div style="width: 54px; height: 54px; border-radius: 54px; cursor: pointer; background-color: #1972F5;">
        chat!
      </div>
    </template>
  </ScriptIntercom>
</template>
```

**loading**

This slot displays content while Intercom is loading.

`**ScriptLoadingIndicator**` supplies a visible state and status label:

```vue
<template>
  <ScriptIntercom app-id="YOUR_APP_ID">
    <template #loading>
      <div class="bg-blue-500 text-white p-5">
        Loading...
      </div>
    </template>
  </ScriptIntercom>
</template>
```

The component declares an `**error**` slot, but its loading branch currently wins whenever `**isReady**` is false, including after a load failure. Use the emitted `**error**` event to render a fallback outside the component until that branch order is fixed.

## [`**useScriptIntercom()**`](https://scripts.nuxt.com/scripts/intercom)

Use [`**useScriptIntercom()**`](https://scripts.nuxt.com/scripts/intercom) when you need the command queue without the launcher component.

```ts
const { proxy } = useScriptIntercom({
  app_id: 'YOUR_APP_ID'
})

// examples
proxy.Intercom('show')
proxy.Intercom('update', { name: 'John Doe' })
```

When an identified user signs out, call `**shutdown**` before another person uses the same browser. Intercom recommends this to clear the prior user's Messenger session:

```ts
proxy.Intercom('shutdown')
```

See [**Registry Scripts**](https://scripts.nuxt.com/docs/guides/registry-scripts) for trigger and loading options.

`**app_id**``string`** required **

Your Intercom app ID.

`**api_base**``'https://api-iam.intercom.io' | 'https://api-iam.eu.intercom.io' | 'https://api-iam.au.intercom.io'`

The regional API base URL. Choose based on your Intercom data hosting region.

`**name**``string`

The name of the logged-in user.

`**email**``string`

The email address of the logged-in user.

`**user_id**``string`

A unique identifier for the logged-in user.

`**alignment**``'left' | 'right'` = 'right'

The horizontal alignment of the Intercom messenger launcher.

`**horizontal_padding**``number` = 20

The horizontal padding (in px) of the messenger launcher from the edge of the page.

`**vertical_padding**``number` = 20

The vertical padding (in px) of the messenger launcher from the bottom of the page.

## Example

Open Intercom from a button:

```vue
<script setup lang="ts">
const { proxy } = useScriptIntercom({
  app_id: 'YOUR_APP_ID',
})

function showIntercom() {
  proxy.Intercom('show')
}
</script>

<template>
  <div>
    <button @click="showIntercom">
      Chat with us
    </button>
  </div>
</template>
```

[Edit this page](https://github.com/nuxt/scripts/edit/main/docs/content/intercom.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/intercom.md)

[**Instagram Embed** Server-rendered Instagram embeds without direct browser requests to Instagram.](https://scripts.nuxt.com/scripts/instagram-embed) [**Example: Pickup Locator** Build a production-shaped store locator with accessible selection, map fallbacks, popups, and a delivery zone.](https://scripts.nuxt.com/scripts/leaflet/guides/pickup-locator)

**On this page **

- [\<ScriptIntercom>](#scriptintercom)
- [useScriptIntercom()](#usescriptintercom)
- [Example](#example)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/scripts/intercom#webpage","@type":"WebPage","description":"Load Intercom through a typed command queue or a click-triggered custom launcher.","name":"Intercom","url":"https://scripts.nuxt.com/scripts/intercom","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/intercom#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/intercom"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/scripts/intercom#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Scripts","item":"https://scripts.nuxt.com/scripts","position":2},{"@type":"ListItem","name":"Intercom","item":"https://scripts.nuxt.com/scripts/intercom","position":3}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
