# `intercom`

The `intercom` registry script. It loads `https://widget.intercom.io/widget/abc12345` for the input of the example. Call `useScriptIntercom(input, options?)` from `@hamur/scripts/<library>` in a component, or list it under `scripts.registry.intercom` to load it on every page.

| | |
|---|---|
| Config key | `scripts.registry.intercom` |
| Function | `useScriptIntercom` of `@hamur/scripts/<library>` |
| Input keys | `appId` (required), `apiBase` |
| Default trigger | `manual` |
| Script | `https://widget.intercom.io/widget/abc12345` |
| Hosts | `widget.intercom.io`, `js.intercomcdn.com`, `api-iam.intercom.io` |
| Bundle | no |
| Collection proxy | no |
| Consent | none |

## Example

````ts [scripts/registry/intercom.ts]
import { defineConfig } from "hamur";
import scripts from "@hamur/scripts";

export default defineConfig({
  framework: "react",
  modules: [scripts],
  scripts: {
    registry: {
      intercom: { appId: "abc12345" },
    },
  },
});
````

It loads when `load()` is called or when the trigger you pass fires. The file is not bundled: it is served from the vendor's host. The script sends its own requests to the vendor.

Every key is checked when the config loads and again in `useScriptIntercom`: a wrong value stops the build with a message that starts with `scripts.registry.intercom`. The registry list is on the [registry](/scripts/registry) page, and the shared options are in [Scripts](/scripts).
