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

Quickstart

This article provides examples of common methods used in the meetings flow for the iOS Messaging SDK. For detailed method parameters, refer to the SDK API Reference.

The Webex instance is the core access point for the SDK, providing access to all Webex SDK methods.

anchorCreate a New Webex Space

anchor

To create a new Webex space:

webex.spaces.create(title: "Hello World") { result in
    switch result {
    case .success(let space):
        // ...
    case .failure(let error):
        // ...
    }
}

anchorAdd a User to a Space

anchor

To add a user to a space:

webex.memberships.create(spaceId: spaceId, personEmail: email) { result in    
    switch result {
        case .success(let membership):
            // Handle success
            print("Membership created: \(membership)")
        case .failure(let error):
            // Handle failure
            print("Error creating membership: \(error)")
        }
    }
}
Post a Message in a Space

To post a message in the space:

webex.messages.post(roomId: "spaceId", text: Message.Text.plain(plain: "hello world")){ response in
    switch result {
        case .success(let message):
            // ...
        case .failure(let error):
            // ...
        }
    }
}

anchorPost a Message with an Attachment

anchor

To post a message to a space with an attachment:

let text = Message.Text.html(html: html)
let thumbnail = LocalFile.Thumbnail(path: thumbnailFilePath, mime: fileType, width: Int(image.size.width), height: Int(image.size.height))

let localFile = LocalFile(path: filePath, name: fileName, mime: fileType, thumbnail: thumbnail, progressHandler: { progress in
                  // Implement progress bar
            })
webex.messages.post(text, toSpace: spaceId, withFiles: localFiles, completionHandler: { response in
    switch response.result {
    case .success(let message):
        // ...
    case .failure(let error):
        // ...
    }
} 

anchorIntercept Messaging Events

anchor

To intercept messaging events:

webex.messages.onEvent = { messageEvent in
    switch messageEvent{
    case .messageReceived(let message):
        // ...
    case .messageDeleted(let messageId):
        // ...
    }
}

anchorManage the Background Connection

anchor

To maintain a websocket connection in the background (allowing background syncing of messages):

webex.phone.enableBackgroundConnection = true 

anchorEnable or Disable Console Logging

anchor

To enable/disable console login:

webex.enableConsoleLogger = true    

anchorSet the Log Level

anchor

To set the current log level:

webex.logLevel = .verbose 

anchorCheck Feature Entitlements for a Logged-In User

anchor

To determine what entitlements a particular logged-in user has:

let capability: ProductCapability = webex.people.getProductCapability()
let hasCalling = capability.isCallingSupported
let hasMeeting = capability.isMeetingSupported
let hasMessaging = capability.isMessagingSupported
In This Article
  • Create a New Webex Space
  • Add a User to a Space
  • Post a Message with an Attachment
  • Intercept Messaging Events
  • Manage the Background Connection
  • Enable or Disable Console Logging
  • Set the Log Level
  • Check Feature Entitlements for a Logged-In User

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.