CreateBlogSupport
Log inSign up
Home
Webex Messaging
  • Overview
  • Guides
  • REST API Basics
  • API REFERENCE
  • All APIs
  • Changelog
  • SDK
  • AI Assistant for Developers
  • Widgets
  • Tutorials
  • Suite Sandbox
  • Beta Program
  • Webex Status API
  • XML API Deprecation

Webex Messaging

Monitor Presence

Presence Status provides real-time status updates about contacts which include predefined states, custom messages and state-specific expiration and last active times.

The presence related methods can be accessed through the PersonClient object.

Available starting from SDK version 3.10.0.

anchorKey Components

anchor

Following are the key methods, and statuses provided for presence monitoring:

  • PresenceHandle

    • getHandle(): Long: Returns the unique handle identifier associated with each contactID.
    • getContactId(): String: Returns the contact ID.
    • isValid(): Boolean: Indicates if the handle is valid, returning false for invalid or bot contact IDs.
  • Presence

    • getContactId(): String: Returns the contact ID associated with this presence status.
    • getStatus(): PresenceStatus: Returns the current presence status.
    • getCustomStatus(): String: Returns a custom status message if set by the user.
    • getLastActiveTime(): Long: Returns the last active UTC time in milliseconds.
    • getExpiresTime(): Long: Returns the status expiration UTC time in milliseconds for states like DND, OutOfOffice, etc.
  • Presence States

    • Unknown
    • Pending
    • Active
    • Inactive
    • DND (Do Not Disturb)
    • Quiet
    • Busy
    • OutOfOffice
    • Call
    • Meeting
    • Presenting
    • CalendarItem

anchorBegin Monitoring Presence

anchor

To monitor presence updates for contacts, use the webex.people.startWatchingPresences() method:

let contactIds = ["ContactId1", "ContactId2"]
let presenceHandles = webex.people.startWatchingPresences(contactIds: contactIds, completionHandler: { presence in
    // Handle presence updates
    print("Updated presence for \(presence.contactId): \(presence.status)")
}

anchorStop Watching Presence

anchor

To stop presence updates use the webex.people.stopWatchingPresences() method, passing in presence handles:

webex.people.stopWatchingPresences(presenceHandles: presenceHandles)

anchorHandle Presence Updates

anchor

Upon receiving a presence update, use the Presence struct to manage and display the returned information.

Be sure to check expiresTime for statuses like DND, OutOfOffice, etc., and use lastActiveTime() to display how long a user has been inactive:

let presenceHandles = webex.people.startWatchingPresences(contactIds: contactIds, completionHandler: { presence in
    // Handle presence updates
    print("Contact: \(presence.contactId)")
    print("Status: \(presence.status}")
    print("Custom Message: \(customStatus)")
    
    if presence.status == PresenceStatus.Inactive {
        print("Last active: (\presence.lastActiveTime)ms ago")
    }

    if [PresenceStatus.OutOfOffice, PresenceStatus.Dnd, PresenceStatus.Quiet].contains(presence.status)
    {
        print("Status expires in: \(presence.expiresTime)ms")                     
    }
}
In This Article
  • Key Components
  • Begin Monitoring Presence
  • Stop Watching Presence
  • Handle Presence Updates

Connect

Support

Developer Community

Developer Events

Contact Sales

Handy Links

Webex Ambassadors

Webex App Hub

Resources

Open Source Bot Starter Kits

Download Webex

DevNet Learning Labs

Terms of Service

Privacy Policy

Cookie Policy

Trademarks

© 2025 Cisco and/or its affiliates. All rights reserved.