DocsBuilding AppsInstalling IntercomAPI & Webhook ReferenceCanvas Kit Reference
DocsApp StoreForumBlogYour Apps

Updating the Last Seen Time

Example Update for Last Seen Time

$ curl https://api.intercom.io/users \
-X POST \
-H 'Authorization:Bearer <Your access token>' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' -d '
{
  "user_id": "25",
  "last_request_at": 1480076371
}'
{
    "type": "user",
    "id": "5714dd359a3fd47136000001",
    "user_id": "25",
    "anonymous": false,
    "email": "[email protected]",
    "phone": "555671243",
    "name": "Hoban Washburne",
    "pseudonym": null,
    "avatar": {
        "type": "avatar",
        "image_url": "https://secure.gravatar.com/avatar/0c3c17fd49f45c43f482730782b36d36?s=24&d=identicon"
    },
    "app_id": "ja43hiec",
    "companies": {
        "type": "company.list",
        "companies": [
            {
                "type": "company",
                "company_id": "366",
                "id": "574854e3ecd0c547ae0000e4",
                "name": "Serenity"
            }
        ]
    },
    "location_data": {
        ...
    },
    "last_request_at": 1480076371,
    "last_seen_ip": "1.2.3.4",
    "created_at": 1460985141,
    "remote_created_at": 1392731331,
    "signed_up_at": 1392731331,
    "updated_at": 1480076399,
    "session_count": 0,
    "social_profiles": {
        "type": "social_profile.list",
        "social_profiles": [
         ...
        ]
    },
    "unsubscribed_from_emails": false,
    "user_agent_data": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9",
    "tags": {
        "type": "tag.list",
        "tags": []
    },
    "segments": {
        "type": "segment.list",
        "segments": []
    },
    "custom_attributes": {
        "paid_subscriber": true,
        "monthly_spend": 155.5,
        "team_mates": 9,
        "last_order_at": 1475569818
    }
}
intercom.users.create(:user_id => '25', :last_request_at => Time.now)
<?php
$intercom->users->create([
    "user_id" => "550",
    "email" => "[email protected]",
    "last_request_at" => (time() - (2*24*60*60)) #2 days ago
]);
?>
user.setUpdateLastRequestAt(true);
User.update(user);

To update the last time the user was seen in your App, send the time in the last_request_at field in a user update request. You can also send update_last_request_at: true to tell the API to update the last request time to the time of your call (in UTC).