1.3.5 • Published 4 years ago

intercom-next v1.3.5

Weekly downloads
2,379
License
ISC
Repository
-
Last release
4 years ago

Intercom-Next

create intercom chat composer in any browser or on the server using javascript. Keep messager up across SSR pages. Easy drop in for Next.js Extra configuration for priority adjustments to keep the main thread unblocked.

Installation

yarn install intercom-next

How to use

On the client or you can use the script on the server like Next.js using the ssr toggle. If your using Next.js you can simply just add the process.browser for ssr to render intercom SSR and have it loaded initally.

const { loadIntercom, initIntercomWindow } = require("intercom-next");

/* 
  Generate the intercom script and load the composer
*/
loadIntercom({
  appId: "myintercomappid", // default : ''
  email: "someEmail@gmail.com", //default: ''
  name: "Some Name", //default: RandomName
  ssr: false, // default: false
  initWindow: true, // default: true
  delay: 0, // default: 0  - usefull for mobile devices to prevent blocking the main thread
});

// If init was set to false initiate the window when needed
initIntercomWindow({ appId: "myintercomappid", email: "someEmail@gmail.com" });

example using on the server

const { createIntercomSSR } = require("intercom-next");

// Optiobal appId property unless app was not established: example in nodejs, make sure to globally set fetch to your request type like axios etc
createIntercomSSR({ appId: "myintercomappid", email: "someEmail@gmail.com" });

app.get("/intercom", (req, res) =>
  createIntercomSSR({
    appId: req.query.appId,
  })
);

Or use in a fetch like manner if needed from the server or clientside. This returns the script for intercom inline for usage.

const { createIntercomSSR } = require("intercom-next");

async function fetchIframe() {
  const intercomScript = await createIntercomSSR(appId);
  return intercomScript;
}

Stop intercom and close composer.

const { shutdownIntercom } = require("intercom-next");

shutdownIntercom();

About

Simply get started with intercom in your app using javascript.

Methods

The intercom constructor using window.Intercom('method')

  1. boot - load intercom
  2. reattach_activator
  3. update - update intercom composer data
1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.9

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.14

4 years ago

1.1.13

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago