{"id":16767196,"url":"https://github.com/j-mendez/next-intercom","last_synced_at":"2025-03-21T23:33:32.961Z","repository":{"id":42098662,"uuid":"238816666","full_name":"j-mendez/next-intercom","owner":"j-mendez","description":"Isomorphic Intercom composer","archived":false,"fork":false,"pushed_at":"2023-07-19T01:55:42.000Z","size":239,"stargazers_count":10,"open_issues_count":3,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-14T06:08:39.097Z","etag":null,"topics":["intercom","intercom-client","intercom-composer","intercom-ssr","intercomjs","node-intercom"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/j-mendez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-07T00:59:04.000Z","updated_at":"2022-09-22T22:45:16.000Z","dependencies_parsed_at":"2024-06-18T22:58:17.696Z","dependency_job_id":"b0202123-9829-40dd-974d-e48ebf697bab","html_url":"https://github.com/j-mendez/next-intercom","commit_stats":{"total_commits":24,"total_committers":7,"mean_commits":"3.4285714285714284","dds":0.6666666666666667,"last_synced_commit":"8e68f40176ace6b2bff0f397c35eca45a4a95c72"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-mendez%2Fnext-intercom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-mendez%2Fnext-intercom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-mendez%2Fnext-intercom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-mendez%2Fnext-intercom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j-mendez","download_url":"https://codeload.github.com/j-mendez/next-intercom/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221820606,"owners_count":16886222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["intercom","intercom-client","intercom-composer","intercom-ssr","intercomjs","node-intercom"],"created_at":"2024-10-13T06:08:38.118Z","updated_at":"2024-10-28T11:15:21.618Z","avatar_url":"https://github.com/j-mendez.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# next-intercom\n\n[![next-intercom](https://circleci.com/gh/j-mendez/next-intercom.svg?style=svg)](https://circleci.com/gh/j-mendez/next-intercom)[![Maintainability](https://api.codeclimate.com/v1/badges/422f08689baacea0631c/maintainability)](https://codeclimate.com/github/j-mendez/next-intercom/maintainability)[![codecov](https://codecov.io/gh/j-mendez/next-intercom/branch/master/graph/badge.svg?token=V6yOdLoHOX)](https://codecov.io/gh/j-mendez/next-intercom)\n\ncreate intercom chat composer in any browser or on the server using javascript. Keep messager up across SSR pages. Easy drop in for Next.js\nExtra configuration for priority adjustments to keep the main thread unblocked.\n\n## Installation\n\n`yarn install next-intercom`\n\n## How to use\n\nOn the client or you can use the script on the server like Next.js using the ssr toggle.\nIf you're using Next.js you can simply just add the `process.browser` for ssr to render intercom SSR and have it loaded initally.\n\n```typescript\nconst { loadIntercom, initIntercomWindow } = require(\"next-intercom\");\n\n/* \n  Generate the intercom script and load the composer\n*/\nloadIntercom({\n  appId: \"myintercomappid\", // default : ''\n  email: \"someEmail@gmail.com\", //default: ''\n  name: \"Some Name\", //default: RandomName\n  ssr: false, // default: false\n  initWindow: true, // default: true\n  delay: 0, // default: 0  - usefull for mobile devices to prevent blocking the main thread\n});\n\n// If init was set to false initiate the window when needed\ninitIntercomWindow({ appId: \"myintercomappid\", email: \"something@email.com\", api_base: \"https://api-iam.intercom.io\" }); // api_base is optional: If on EU servers use `https://api.eu.intercom.io`\n```\n\nexample using on the server\n\n```typescript\nconst { createIntercomSSR } = require(\"next-intercom\");\n\n// Optiobal appId property unless app was not established: example in nodejs, make sure to globally set fetch to your request type like axios etc\napp.get(\"/intercom\", (req, res) =\u003e\n  createIntercomSSR({\n    appId: req.query.appId,\n  })\n);\n```\n\nOr use in a fetch like manner if needed from the server or clientside. This returns the script for intercom inline for usage.\n\n```typescript\nconst { createIntercomSSR } = require(\"next-intercom\");\n\nasync function fetchIframe() {\n  const intercomScript = await createIntercomSSR(appId);\n  return intercomScript;\n}\n```\n\nStop intercom and close composer.\n\n```typescript\nconst { shutdownIntercom } = require(\"next-intercom\");\n\nshutdownIntercom();\n```\n\nAdd events to Intercom.\n\n```ts\nconst { updateIntercom } = require(\"next-intercom\");\n\nupdateIntercom(\"onShow\", function newEvent() {\n  console.log(\"composer opened!\");\n});\n```\n\nTrack an Intercom event.\n\n```typescript\nconst { trackEvent } = require(\"next-intercom\");\n\nvar metadata = {\n  invitee_email: \"pi@example.org\",\n  invite_code: \"ADDAFRIEND\",\n};\n\ntrackEvent(\"invited-friend\", metadata);\n```\n\n## About\n\nSimply get started with intercom in your app using javascript.\n\n## Methods\n\nThe intercom constructor using window.Intercom('method')\n\n1. boot - load intercom\n2. reattach_activator\n3. update - update intercom composer data\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-mendez%2Fnext-intercom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj-mendez%2Fnext-intercom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-mendez%2Fnext-intercom/lists"}