angular-intercom

An Angular.js wrapper for Intercom.io

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
angular-intercom
8992.1.15 years ago9 years agoMinified + gzip package size for angular-intercom in KB

Readme

angular-intercom Build Status
An Angular.js wrapper for Intercom.io providing a simple and familiar API for Angular Developer. I also added a asynchronous loading option $intercomProvider.asyncLoading(true) to allow anyone to quickly drop in and start using Intercom. This is great for startups who need a quick and easy way to interact with their customers
How do I add this to my project?
You can download angular-intercom by:
  • (prefered) Using bower and running bower install angular-intercom --save
  • Using npm and running npm install angular-intercom --save
  • Downloading it manually by clicking here to download development (unminified) (minified)
  • CDN https://cdn.rawgit.com/gdi2290/angular-intercom/master/angular-intercom.min.js
Example
Here is a simple Example App which allows you to include your own app_id to test. Below is a quick start guide. Use either $intercom or Intercom service depending on your preference and opinions. ````html



````
Require.js/AMD
angular-intercom is provides a Require.js/AMD interface, however it works differently depending on if you are using $intercomProvider.asyncLoading(true)or not.
If you are using $intercomProvider.asyncLoading(true), then don't specify the "intercom" dependency at all, just load "angular_intercom" in paths, i.e.
paths: {
  "angular_intercom": '/somePath/angular-intercom/angular-intercom'
}

If you wish to load the intercom library through Require.js/AMD rather than using $intercomProvider.asyncLoading(true), you first need to find the CDN url provided by intercom.io. To do this, curl the url you received from intercom.io during intercom.io setup
curl https://widget.intercom.io/widget/INTERCOM_APPID

You should get something like
<html><body>You are being <a href="https://js.intercomcdn.com/intercom.xxxxxxx.js">redirected</a>.</body></html>

This means your CDN url is https://js.intercomcdn.com/intercom.xxxxxxx.js. Now in your paths for require.js, you would have something like this (remember to remove the .js at the end of the CDN url)
paths: {
  "intercom": "https://js.intercomcdn.com/intercom.xxxxxxx",
  "angular_intercom": '/somePath/angular-intercom/angular-intercom'
}

And in your shim, you would do this
shim: {
  "angular_intercom": ["intercom"]
}

When "intercom" loads, it will attach itself to window, which will automatically be detected by angular-intercom
Then you can just use "angularintercom" as any other Require.js/AMD module definition, i.e.
define(['angular', 'angular_intercom'], function(angular, angular_intercom) {
  // Bootstrap angular here
});
Node.js
In node.js, angular-intercom will try and require a intercom dependency. If this fails, it will expect the Intercom object to exposed via the global object
Intercom.io
What is Intercom? An entirely new way to connect with your customers. Intercom shows you who is using your product and makes it easy to personally communicate with them through targeted, behavior-driven email and in-app messages.
Changelog
Please see changelog for recent updates
License
MIT