PHPackages                             silverstripe/intercom - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. silverstripe/intercom

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

silverstripe/intercom
=====================

SilverStripe integration with Intercom.io

2.0.1(6y ago)12.9k5[4 issues](https://github.com/silverstripe/silverstripe-intercom/issues)BSD-3-ClausePHPPHP ^5.4 || ^7CI failing

Since Nov 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/silverstripe/silverstripe-intercom)[ Packagist](https://packagist.org/packages/silverstripe/intercom)[ RSS](/packages/silverstripe-intercom/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (15)Used By (0)

SilverStripe Intercom Module
============================

[](#silverstripe-intercom-module)

[![Build Status](https://camo.githubusercontent.com/865b8c915133a3bb5f6a1678f2bbb6bc1ea0ce00e78d6b4fee8adedbf8b42807/68747470733a2f2f7472617669732d63692e6f72672f73696c7665727374726970652f73696c7665727374726970652d696e746572636f6d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/silverstripe/silverstripe-intercom)

This module provides SilverStripe integration for [Intercom](https://www.intercom.io/).

Requirements
------------

[](#requirements)

- SilverStripe Framework 4.0 or higher (3.x support in `1.x` branches and tags). Works nicely with the CMS but it isn't required.
- PHP &gt;=5.6.0

Installation
------------

[](#installation)

Install the module with composer, just like all your favourite modules!

```
composer require silverstripe/intercom

```

Documentation
-------------

[](#documentation)

You can find detailed documentation in the [docs folder](docs/index.md).

License
-------

[](#license)

See [license.md](license.md)

How it works
------------

[](#how-it-works)

Intercom's integration is quite simple: a few lines of JavaScript added just before the `` tag. The module adds through its own RequestFilter.

Configuration
-------------

[](#configuration)

The module will make use of the following global constants in your `.env` file. You should set these up:

- `INTERCOM_APP_ID`: The "App ID" from Intercom's integration settings. Required.
- `INTERCOM_PERSONAL_ACCESS_TOKEN`: The "Personal Access Token" from Intercom's integration settings. Required.
- `INTERCOM_SECRET_KEY`: The secret key given by Intercom's Secure Mode. Optional, but highly recommended.

Note that if you disclose your secret key to anyone, they could impersonate users of your app and chat to your support team, so keep it secure! The App ID is less sensitive as it is in the HTML source of your site.

I recommend that you enable the "Test Version" of Intercom. This will give you a second App ID that you should use on your test and development environments.

Your application can customise the information send with the following properties

```
SilverStripe\Intercom\IntercomScriptTags:
  anonymous_access: true
  company_property: Organisation
  company_fields:
    name: Title
    plan: AccountPlan
  user_fields:
    favourite_colour: FavouriteColour
```

- `anonymous_access`: If true, then the integration code will be supplied even for anonmyous visitors. This is used for Intercom Acquire.
- `always_anonymous`: If true, then the integration code will never be populated with the details of the current user. Allows better caching. This is used for Intercom Acquire.
- `company_property`: The property on a member that points to their organisation
- `company_fields`: A map of Intercom field name to organisation properties to pass through
- `user_fields`: A map of Intercom field name to member properties to pass through

### Only show Intercom sometimes

[](#only-show-intercom-sometimes)

The `SilverStripe\Intercom\IntercomScriptTags` class has a configuration value, `enabled`, that can will disable any inclusion of Intercom script tags if set to false.

If you wish to show Intercom only sometimes, you can update this configuration value at any time during your page load, with the following command. For example, you may choose to show Intercom only on certain pages, or for certain users.

```
\SilverStripe\Intercom\IntercomScriptTags::config()->enabled = false;
```

Usage
-----

[](#usage)

### Tracking events

[](#tracking-events)

You can track events with the `Intercom::trackEvent()` method. The event will be tracked against the current user.

```
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Intercom\Intercom;

$intercom = Injector::inst()->get(Intercom::class);
$intercom->trackEvent('test-event', array(
    'something' => 'a value',
    'other-one' => 'moar data',
));
```

You can also explicitly specify which user this event should be tracked against:

```
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Intercom\Intercom;
use SilverStripe\Security\Member;

$member = Member::get()->byID(34);
$intercom = Injector::inst()->get(Intercom::class);
$intercom->trackEvent('test-event', array(
    'something' => 'a value',
    'other-one' => 'moar data',
), $member);
```

```
$client->trackEvent("test-event", [
    "something" => "a value",
    "other-one" => "moar data",
], Member::get()->byID(34));
```

Note that you can't currently track events for anonymous visitors; a LogicException will be thrown if you try.

### Synchronising users via the API

[](#synchronising-users-via-the-api)

Sometimes, it's not enough to wait until users log in to have their Intercom data updated. For example, if you want to use Intercom to send emails you may want to update the Intercom database before the first email is sent.

For this purpose, you can set `dev/tasks/IntercomBulkLoadTask` to run on a cronjob. By default it will synchronise all Member objects. If you wish to synchornise a reduced list of Members, you can set the `user_list` config option on the Intercom class. This should be of the form `%$ServiceName`, where ServiceName is the name of an Injector service.

```
SilverStripe\Intercom\Intercom:
  user_list: %$AllPlatformUsers
SilverStripe\Core\Injector\Injector:
  AllPlatformUsers:
    factory: AllUserListFactory
```

In the preceding example, we're using a custom factory class called `AllUserListFactory` to define Member DataList. It needs to have a method called `create()` that returns a `DataList` of `Member`s.

```
use SilverStripe\Security\Member;

/**
 * Factory for generating a DataList of all platform users
 */
class AllUserListFactory
{
    public function create($class, $params)
    {
        return Member::get()->filter(['Some' => 'Value']);
    }
}
```

### Integration with forms

[](#integration-with-forms)

To send data to Intercom from a form, you can use `SilverStripe\Intercom\IntercomFormExtension`.

```
SilverStripe\Forms\Form:
  extensions:
    - SilverStripe\Intercom\IntercomFormExtension
```

This will provide several chainable methods to the `Form` class that help you map form fields to Intercom fields.

```
$form
    ->addIntercomUserFieldMapping([
		'FullName' => 'name',
		'EmailAddress' => 'email'
	])
	->addIntercomCompanyFieldMapping([
		'CompanyName' => 'name'
	])
	->sendToIntercom();
```

For custom attributes, prefix the field name with `$`.

```
$form->addIntercomUserFieldMapping([
    "FavouriteColour" => "\$favourite_color"
]);
```

Additionally, you can stuff assorted fields into a monolithic "note" for the user in Intercom. This map is keyed with labels that should precede the values for each field.

```
$form
    ->addIntercomNoteMapping([
		'SoftwareVersion' => 'The user is running version:'
	])
	->setIntercomNoteHeader('More information about this user');
```

The above will create a note similar to:

```
More information about this user

    The user is running version: ${SoftwareVersion}

```

#### Integration with Userforms

[](#integration-with-userforms)

See the [silverstripe-intercom-userforms](https://github.com/unclecheese/silverstripe-intercom-userforms) module by Uncle Cheese.

Maintainers
-----------

[](#maintainers)

- Sam Minnée

Bugtracker
----------

[](#bugtracker)

Bugs are tracked in the [issues section](https://github.com/silverstripe/silverstripe-intercom/issues) of this repository. Before submitting an issue please read over existing issues to ensure yours is unique.

If the issue does look like a new bug:

- Create a new issue
- Describe the steps required to reproduce your issue, and the expected outcome. Unit tests, screenshots and screencasts can help here.
- Describe your environment as detailed as possible: SilverStripe version, Browser, PHP version, Operating System, any installed SilverStripe modules.

Please report security issues to the module maintainers directly. Please don't file security issues in the bugtracker.

Development and contribution
----------------------------

[](#development-and-contribution)

If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 52.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~103 days

Recently: every ~234 days

Total

14

Last Release

2500d ago

Major Versions

0.0.7 → 2.x-dev2016-03-30

1.x-dev → 3.0.0-beta12019-01-23

PHP version history (5 changes)0.0.1PHP &gt;5.4.0

0.0.5PHP &gt;=5.4.0

2.x-devPHP ^5.4

1.0.0PHP &gt;=5.6.0

2.0.1PHP ^5.4 || ^7

### Community

Maintainers

![](https://www.gravatar.com/avatar/b0cba8b534e20e6ab4fff555a97b237a18436ebca1446fc0b29c8a8b504038b9?d=identicon)[GuySartorelli](/maintainers/GuySartorelli)

![](https://www.gravatar.com/avatar/be6648e60fbab6f70bfc34dd8c14259562d28a47510a934ea9c01fe98633f3c2?d=identicon)[sminnee](/maintainers/sminnee)

---

Top Contributors

[![assertchris](https://avatars.githubusercontent.com/u/200609?v=4)](https://github.com/assertchris "assertchris (12 commits)")[![lexakami](https://avatars.githubusercontent.com/u/7085702?v=4)](https://github.com/lexakami "lexakami (5 commits)")[![robbieaverill](https://avatars.githubusercontent.com/u/5170590?v=4)](https://github.com/robbieaverill "robbieaverill (4 commits)")[![amolswnz](https://avatars.githubusercontent.com/u/20012807?v=4)](https://github.com/amolswnz "amolswnz (1 commits)")[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (1 commits)")

### Embed Badge

![Health badge](/badges/silverstripe-intercom/health.svg)

```
[![Health](https://phpackages.com/badges/silverstripe-intercom/health.svg)](https://phpackages.com/packages/silverstripe-intercom)
```

###  Alternatives

[silverstripe/multi-domain

Allows multiple domains to access one CMS instance, mapping them to different sections of the hierarchy

141.6k](/packages/silverstripe-multi-domain)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
