Updating a user

You can send any data you like to Intercom. Typically our customers see a lot of value in sending data that relates to customer development, such as price plan, value of purchases, etc. Once these have been sent to Intercom you can then apply filters based on these attributes.

Attributes such as the user email or a user's name can be updated by calling:

[Intercom updateUserWithAttributes:@{ @"email" : @"joe@example.com", @"name" : @"Joe" }];

Custom user attributes can be created and modified by passing a custom_attributes dictionary You do not have to create attributes in Intercom beforehand. If one hasn't been seen before, it will be created for you automatically.

[Intercom updateUserWithAttributes:@{
     @"custom_attributes": @{
         @"paid_subscriber" : @YES,
         @"monthly_spend": @155.5,
         @"team_mates": @3
     }
 }];

You can also set company data via this call by submitting an attribute dictionary like

[Intercom updateUserWithAttributes:@{ 
    @"companies": @[ @{
        @"name" : @"My Company",
        @"id" : @"abcd1234"
    }
 ]}];

Where id is a required field for adding or modifying a company. A detailed description of the company model is available here.

Events

You can log events in Intercom based on user actions in your app. Events are different to custom user attributes in that events are information on what Users did and when they did it, whereas custom user attributes represent the User's current state as seen in their profile. See details about Events here.

[Intercom logEventWithName:@"ordered_item" metaData: @{
    @"order_date": @1392036272,
    @"stripe_invoice": @"inv_3434343434",
    @"order_number": @{
    @"value": @"3434-3434",
    @"url": @"https://example.org/orders/3434-3434"
}];

Messaging

With Intercom you can send and receive messages from within your iPhone and iPad apps once you are on an appropriate plan.

Sending messages to users

The Intercom Messenger will automatically check for new messages in the background and the message preview will appear when there is a new message (or open automatically depending on the message type). When a user taps on the message preview, the Messenger window will appear as an overlay on your app.

Letting your users contact you

You can use Intercom to let your users start conversations with you, to ask for help or to give feedback. Once you're on a plan that allows for Inbound messaging, such as Support, simply call the following method to show the Intercom new message composer:

[Intercom presentMessageComposer];

If you want to show a conversation list rather than a new message composer, call this method:

[Intercom presentConversationList];

For best results, attach these calls to buttons in your UI so users can choose when to get in touch with you.

Intercom Messenger Welcome Message

In your app's settings messaging section you can add a Welcome Message that will be shown to your users when they compose a new message with the Intercom Messenger.

Customising message appearance

By default, the Messenger reads the theme color that is set from within Intercom. To change this color: log into Intercom, go to your app's settings page and go to the "Appearance" section. Now set your color of choice.

Customising preview positions

Depending on the layout of your app you may need to tweak the position of an incoming message's preview so as to not infringe on other elements in your UI. By default, incoming message previews will appear in the bottom left of your application's window. If you wish to change this you can specify and alternative position by using the setPreviewPosition: method. If you need to adjust the padding further for one of these positions, call setPreviewPaddingWithX:y:.

Temporarily hiding the notification view

You can call [Intercom setMessagesHidden:YES] to prevent all messages from appearing in certain parts of your application, or during certain activities (such as when using the camera). You can activate messages again by calling [Intercom setMessagesHidden:NO].

Intercom and UIWindow

Intercom opens in its own UIWindow on top of your application's window. In order to ensure the keyboard events are sent to Intercom, we temporarily makes the Intercomwindow the key window of your app. Once the Intercom window is closed, the key window is restored again to your application window.

Logging

By default Intercom logs only errors. By calling the enableLogging method, you can see Intercom log messages in the console. It is recommended to use this only for debugging purposes.

What next?

Now that you have Intercom configured it's time to configure your app for Push Notifications.

Did this answer your question?