Chatbox SDKs
Give Feedback

iOS Chat SDK

Updated on March 26, 2024

Willing to add a Chat SDK to your iOS mobile app? Get started with Crisp in order to improve your customer support and user engagement today. Made easy thanks to SwiftPM and CocoaPods — Install it in a few steps.

Notice

The minimum iOS version target for the SDK is iOS 13 (this covers roughly 96% of iPhone devices).

Swift documentation

Looking for the extensive Swift documentation? It is available here.

Video Tutorial

Introduction Video


Overview

The Crisp iOS Chat SDK comes with two distinct libraries:

  1. Crisp

  2. CrispWebRTC

CrispWebRTC is required if you want to make audio or video calls to your users. If you’re sure however that you will not need this functionality you can use the Crisp library instead and save ~10 MB in binary size.

Both libraries are drop-in replacements, meaning that they have the exact same API. The only changes you’ll need to perform when switching libraries is to update your Package.swift or Podfile and change any imports from

import Crisp

to

import CrispWebRTC

or vice versa.

Make sure to add the required Info.plist keys to your project. CrispWebRTC needs additional keys due to the camera and microphone access. See Update your Info.plist.
Crisp calls are currently not supported on MacCatalyst.

Installation

1. Install the Chat widget SDK to your iOS mobile app

Option 1: Using SwiftPM

To use the Crisp iOS Chat SDK with SPM, add a dependency to your Package.swift file:

let package = Package(
  dependencies: [
    .package(url: "https://github.com/crisp-im/crisp-sdk-ios.git", .upToNextMajor(from: "2.0.0")),
  ],
  targets: [
    .target(
      name: "<target-name>",
      dependencies: [
        .productItem(name: "CrispWebRTC", package: "crisp-sdk-ios")
        // or: .productItem(name: "Crisp", package: "crisp-sdk-ios")
      ]
    )
  ]
)

Option 2: Using CocoaPods

Add Crisp to your CocoaPods Podfile:

use_frameworks!

target :YourTargetName do
  pod 'CrispWebRTC'
  # or pod 'Crisp'
end

Then run: pod install

Option 3: Manual installation

  1. Download and extract the Crisp iOS Chat SDK.
  2. Drag the Crisp.xcframework into your project, select Copy items if needed in the following dialog and click Finish.
  3. Finally, configure the Crisp.xcframework to Embed & Sign in the Frameworks, Libraries, and Embedded Content section of your app's target settings.
1. Drag framework to project
2. Copy items if needed
3. Embed and Sign

2. Update your Info.plist

To enable your users to take and upload photos to the chat as well as download photos to their photo library, add:

Update Info.plist

3. Configure the Crisp iOS Chat SDK

Go to your Crisp Dashboard, and copy your Website ID:

Copy your Website ID
While you are on your Crisp dashboard, please ensure that the Lock the chatbox to website domain setting has been disabled to avoid Error starting chat errors. This setting can be found in Settings > Website Settings > Chatbox & Email Settings > Chatbox Security.

Then, configure the Website ID in the SDK code:

import CrispWebRTC

// In your func application()
CrispSDK.configure(websiteID: "YOUR_WEBSITE_ID")
Configure CrispSDK

4. Present the ChatViewController

import CrispWebRTC

class ViewController: UIViewController {
    @IBAction func startChat(_ sender: Any) {
        self.present(ChatViewController(), animated: true)
    }
}
Present ChatViewController

Availables APIs

Swift APIs

The extensive Swift documentation is available here.

  • CrispSDK.configure(websiteID: "YOUR_WEBSITE_ID") — Configures the SDK with a website_id
  • CrispSDK.setTokenID(tokenID: "A_CUSTOM_ID") — Assigns session with a token_id
  • CrispSDK.user.email = "john.doe@gmail.com" — Sets user email
  • CrispSDK.user.nickname = "John Name" — Sets user name
  • CrispSDK.user.phone = "003370123456789" — Sets user phone
  • CrispSDK.user.avatar = URL(string: "https://pbs.twimg.com/profile_images/782474226020200448/zDo-gAo0_400x400.jpg") — Sets user avatar
  • CrispSDK.user.company = Company(name: "Acme", url: nil, companyDescription: nil, employment: nil, geolocation: nil) — Sets user compay
  • CrispSDK.session.setString("custom_value", forKey: "custom_key") — Sets session data string
  • CrispSDK.session.setInt(42, forKey: "custom_key") — Sets session data int
  • CrispSDK.session.pushEvents([SessionEvent(name: "Signup", color: SessionEventColor.blue)]) — Pushes an array of events (separated by a comma)
  • CrispSDK.session.segment = "app" — Sets session segment
  • CrispSDK.session.reset() — Resets the session
  • CrispSDK.searchHelpdesk() — Opens the helpdesk
  • CrispSDK.openHelpdeskArticle(locale: "en", slug: "1h6ppad", title: nil, category: nil) — Opens an helpdesk article

Examples of Crisp implementation on iOS apps

If you are looking to find examples of real-world exemples from our customers, we have you covered. Below you will find a selection of hand-picked iOS apps showcasing how our chatbox feels and looks on your Apple device.

  • RunMotion Coach — is a running planner application to help meet your objectives
  • Jomo — helps you manage your screen time and stay focused throughout your day
  • Emma-app — serves as a friendly budget management and financial companion
  • Savvy Navvy — acts as your own digital coral reef to prepare against the tides