iOS SDK

This guide walks you through installing, configuring, and launching the WotNot chat widget natively in your iOS app (SwiftUI or UIKit).

1. Installing the SDK

Supports Xcode 13+ for both SwiftUI and UIKit projects.

1. Open Xcode → Add SPM Package

File → Add Packages…

2. Enter the SDK Package URL

In the dialog box that appears, paste the WotNotSDK repository URL into the search bar/text field.

https://github.com/wotnotbot/ios-sdk

3. Configure dependency rule

  • Rule: Up to Next Major Version

  • Set the version to the required SDK version

This ensures you automatically get minor improvements without risking breaking changes.

4. Add the package

Click Add Package, and Xcode will fetch and integrate the SDK.

Step 2: Add required permissions

Add the following permission to your Info.plist:

Step 3: Import the SDK

Add this import wherever you use the widget:

2. Configuration

Step 1: Create a WidgetConfig

This WidgetConfig object contains your bot credentials and optional UI settings.

Where to find these credentials

YOUR_BOT_ID — open the bot you want to embed, and copy the bot_id from the URL.

YOUR_ACCOUNT_ID — goto Settings > Account Settings and copy the account_id from the URL.

YOUR_ACCOUNT_KEY — Goto the bot list screen, open the embed option from context menu and copy the highlighted key.

Step 2: Initialize the SDK

Initialize inside your App struct or View

3. Launching chat screens (SwiftUI)

The SDK provides several functions that return SwiftUI View objects. These can be presented using NavigationLink, .sheet(), or other SwiftUI presentation methods.

3.1 Launch conversation list (Full Screen)

Opens the conversation in a full screen mode.

3.2 Launch conversation list (Bottom Sheet)

Opens the conversation list in a bottom sheet.

3.3 Launch conversation detail (Without Passing a Key)

Opens the conversation detail screen without passing a key. Useful when history retention logic is handled by bot preferences.

4. Theme customization

Customize colors for bubbles, text, accents, and error states.

4.1 Theme colors reference

Property
Setter
Default
Used For

accentPrimary

accentPrimary: Color(...)

#0075ff

Buttons, headers, links

userMessageTextColor

visitorMessageTextColor: Color(...)

#FFFFFF

User message text & timestamp

botMessageBackgroundColor

botMessageBackgroundColor: Color(...)

#F2F5F8

Bot message bubble background color

botMessageTextColor

botMessageTextColor: Color(...)

#1C1C1E

Bot text & timestamp

accentSecondary

accentSecondary: Color(...)

#d4e3ffff

Secondary accents

gray8

setGray8()

#F2F5F8

Bot message background

failurePrimary

failurePrimary: Color(...)

#FF0000

Error messages

failureSecondary

failureSecondary: Color(...)

#FFEBEE

Error states

4.2 Applying a custom theme

Apply the theme after initialization:

Complete integration example

Below is a streamlined full example.

Last updated

Was this helpful?