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.
; /* Generate the intercom script and load the composer*/loadIntercom; // If init was set to false initiate the window when neededinitIntercomWindow;
example using on the server
; // Optiobal appId property unless app was not established: example in nodejs, make sure to globally set fetch to your request type like axios etccreateIntercomSSR; app.get"/intercom",createIntercomSSR;
Or use in a fetch like manner if needed from the server or clientside. This returns the script for intercom inline for usage.
;
Stop intercom and close composer.
; shutdownIntercom;
About
Simply get started with intercom in your app using javascript.
Methods
The intercom constructor using window.Intercom('method')
- boot - load intercom
- reattach_activator
- update - update intercom composer data