iOS Chatbot SDK

View Release Notes →

dialogs_Chatbot_iOS embeds a fully functional EnableX Dialogs chatbot into any native iOS application. The SDK renders its own complete chat UI on top of an internal WKWebView — a WKScriptMessageHandler JS bridge (EnxBotJSBridgeManager) connects the embedded bot engine to native Swift callbacks, so your app never touches the WebView directly.

iOS Chatbot SDK v1.0.0  ·  Released June 25, 2026

First release of the iOS Chatbot SDK. See Release Notes for what's included.

  Download iOS Chatbot SDK v1.0.0
Setup

Requirements

ItemRequirement
iOS15.0 or later
Swift5.0 or later
Xcode15.0 or later
NetworkActive internet connection required
PermissionsCamera, Photo Library (only if attachment features are used)

Installation

Manual XCFramework

  1. Copy dialogs_Chatbot_iOS.xcframework into your Xcode project
  2. In Xcode → Target → General → Frameworks, Libraries, and Embedded Content
  3. Add dialogs_Chatbot_iOS.xcframework → set to Embed & Sign

Swift Package Manager

// Package.swift
.binaryTarget(
    name: "dialogs_Chatbot_iOS",
    url: "https://your-release-url/dialogs_Chatbot_iOS.xcframework.zip",
    checksum: "YOUR_CHECKSUM_HERE"
)

Project Setup

Info.plist Permissions

Add the following keys to your Info.plist if you enable media/file attachments:

<key>NSCameraUsageDescription</key>
<string>Required to take photos and videos for the chat bot</string>

<key>NSPhotoLibraryUsageDescription</key>
<string>Required to attach images and videos from your library</string>

<key>NSMicrophoneUsageDescription</key>
<string>Required for audio and video calls</string>

App Transport Security

The SDK connects to remote bot servers over HTTPS. Ensure ATS is not blocking your bot's host domain.

Basic Integration

Step 1 — Import

import dialogs_Chatbot_iOS

Step 2 — Create Configuration

let config = EnxBotConfiguration(
    botId:       "YOUR_BOT_ID",      // from EnableX/Dialogs dashboard
    host:        "https://dialogs.enablex.io",
    path:        "",                  // optional, leave empty if not needed
    callingView: false               // true = click-to-call UI
)

Step 3 — Connect and Display

class ViewController: UIViewController {

    var botView: EnxBotContainerView!

    override func viewDidLoad() {
        super.viewDidLoad()

        botView = EnxChatClient.connect(
            configuration: config,
            eventListner: self
        )
        botView.attach(to: self.view)
    }
}

Step 4 — Handle Delegate

extension ViewController: EnxChatClientDelegate {
    func didBotConnected(_ botInfo: [String: Any]) {
        print("Bot name:", botInfo["name"] ?? "")
    }
}

Chat Mode vs Click-to-Call Mode

The SDK supports two distinct UI modes controlled by EnxBotConfiguration.callingView.

Chat Mode (callingView: false)

  • Displays the full chat interface (message list + input bar)
  • Input bar includes attachment options: camera, photo, video, file
  • Bot can send: text, images, videos, files, suggestions, action cards, date picker
  • User can send: text messages + media attachments

Click-to-Call Mode (callingView: true)

  • Displays a full-screen click-to-call interface
  • Shows a large call button; tapping sends "Hi" to start the bot flow
  • Bot responds with handover status updates displayed on screen
  • When bot triggers a call, a floating WebView appears with the video/audio session
  • Use EnxChatClient.getCallingView() to get audio/video call buttons for the navigation bar
// Click-to-Call setup
let config = EnxBotConfiguration(
    botId: "YOUR_BOT_ID",
    host:  "https://dialogs.enablex.io",
    callingView: true
)
let botView = EnxChatClient.connect(configuration: config, eventListner: self)
botView.attach(to: self.view)

// Add call buttons to nav bar
let callingView = EnxChatClient.getCallingView()
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: callingView)

Resetting the Bot

To clear the current conversation and restart:

botView.resetBot()

This sends a JavaScript command to the embedded WebView to call resetConversation() or equivalent on the bot engine.

Messages & Media

Supported Message Types

TypeDirectionDescription
textBot ↔ UserPlain text or markdown formatted text
photoBot ↔ UserImage with optional caption and action buttons
videoBot ↔ UserVideo attachment
fileBot ↔ UserDocument/file attachment
action / cardBot → UserCard with action buttons (URL or call)
single-choiceBot → UserSingle-select suggestion chips
multi-choiceBot → UserMulti-select suggestion chips
calendarBot → UserDate picker modal
systemBot → UserSystem status message (handover events)
typingBot → UserAnimated typing indicator

Supported Media Types

Sending (User → Bot)

TypeSourceFormat
ImagePhoto LibraryJPEG (compressed to 30% scale, 75% quality)
ImageCameraJPEG (compressed)
VideoPhoto LibraryOriginal format (MP4, MOV, etc.)
FileFiles AppPDF, images, text, data files

Image compression: Images are automatically resized to 30% of original dimensions and compressed to 75% JPEG quality before sending. Maximum recommended: images under 10 MB original size.

Receiving (Bot → User)

TypeRendered As
Remote image URLInline image with tap-to-fullscreen
Remote video URLVideo player
Remote file URLDownloadable file attachment
Architecture

Architecture Overview

┌─────────────────────────────────────────────────────┐
│                   Host Application                   │
│                                                      │
│   ViewController  ──────────────────────────────┐   │
│        │                                        │   │
│        │ EnxChatClient.connect(...)             │   │
│        ▼                                        │   │
├─────────────────────────────────────────────────┤   │
│              EnxChatClient (Static API)         │   │
│        │                                        │   │
│        ▼                                        ▼   │
│  EnxBotContainerView         EnxChatClientDelegate  │
│   ├── EnxChatListView               ▲               │
│   ├── EnxChatInputView              │               │
│   ├── EnxClickToCallingView   didBotConnected(...)  │
│   ├── EnxVideoContainerView         │               │
│   └── EnxBotWebViewManager ─────────┘               │
│         ├── WKWebView                               │
│         └── EnxBotJSBridgeManager                  │
│               └── WKScriptMessageHandler            │
└─────────────────────────────────────────────────────┘

Data Flow

User types → EnxChatInputView → EnxBotWebViewManager.sendMessage()
                                        │
                                        ▼
                                  WKWebView (JS)
                                  sendMessageToBot()
                                        │
                                   Bot Server
                                        │
                                        ▼
                                  WKScriptMessageHandler
                                  EnxBotJSBridgeManager
                                        │
                                        ▼
                                 EnxBotWebViewManager
                                  onBotMessage callback
                                        │
                                        ▼
                                EnxBotResponseParser
                                        │
                                        ▼
                                 EnxChatListView
                                 (renders message)

Component Descriptions

ComponentRole
EnxChatClientPublic static API. Entry point for all SDK usage
EnxBotConfigurationValue object holding bot connection settings
EnxBotContainerViewRoot UIView. Orchestrates all child views and the web engine
EnxBotWebViewManagerManages WKWebView lifecycle, JS initialisation, message sending/receiving
EnxBotJSBridgeManagerWKScriptMessageHandler bridge between JS and Swift
EnxChatListViewUITableView displaying all chat messages grouped by date
EnxChatInputViewBottom input bar with text field, send button, and attachment panel
EnxChatMessageCellUITableViewCell rendering text, media, suggestion chips, actions
EnxClickToCallingViewFull-screen click-to-call UI (used when callingView = true)
EnxCallingViewUIStackView with audio + video call buttons for nav bar
EnxVideoContainerViewFloating draggable WebView container for video/audio calls with PiP
EnxImagePreviewControllerFull-screen image preview presented when user taps a received image
EnxTypingIndicatorViewAnimated three-dot typing indicator
EnxDatePickerViewModal date picker presented for calendar-type bot messages
EnxBotResponseParserParses raw JSON payloads from the bot into EnxChatMessage models
EnxMarkdownParserConverts markdown text from the bot into NSAttributedString
EnxChatSettingSingleton storing session state (sessionId, conversationId, botInfo)
Feature Support

Feature Support (v1.0.0)

FeatureSupportedNotes
Full chat UIYesMessage list grouped by date with date section headers, input bar, animated typing indicator.
Markdown renderingYesBold, italic, links in bot messages via EnxMarkdownParser.
Text messagesYesPlain text, user ↔ bot.
Suggestion chips (single/multi-choice)Yes 
Image / video / file attachmentsYesSend from photo library, camera, or Files app; receive from bot with tap-to-fullscreen.
Action cardsYesButtons with URL or call actions.
Calendar (date picker) promptsYes 
System / handover status messagesYesinitiated, assigned, unassigned, noAgent, resolved, expired, disconnected.
Click-to-call (audio / video)YesFull-screen click-to-call UI plus a floating, draggable PiP WebView for active calls.
Conversation resetYesEnxBotContainerView.resetBot().
Message queueing before readyYesMessages sent before the bot is ready are buffered and flushed automatically.
Objective-C interopYesEnxChatClient, EnxBotConfiguration, EnxBotContainerView, and EnxCallingView are @objcMembers.
Multi-bot supportNoEnxChatClient uses static properties — only one bot connection per app session.
UI customization APINoNot available in v1.0 — the SDK renders its own complete UI.
Reference

Error Handling

The SDK handles most errors internally. The host app does not need error handling for normal flows.

ScenarioSDK Behaviour
No internet on startWebView fails to load; bot stays in idle state
Message sent before readyMessage is queued and sent automatically once ready
Camera not available on deviceSilent no-op (camera option still shown; permission denied by OS)
Directory selected in file pickerAlert shown: “Unsupported File”
JS evaluation errorLogged to console; message not sent
Bot JS reset function not foundTries multiple function names (resetConversation, clearConversation, reset)

FAQ

Can I add the bot view without using attach(to:)?

Yes. attach(to:) is a convenience helper. You can add EnxBotContainerView to your view hierarchy manually and set constraints yourself.

Can I use the SDK with multiple bots simultaneously?

Not in the current version. EnxChatClient uses static properties — only one bot connection is supported per app session.

Does the SDK support Objective-C?

Yes. EnxChatClient, EnxBotConfiguration, EnxBotContainerView, and EnxCallingView are annotated with @objcMembers and public visibility, making them accessible from Objective-C.

How large can attachments be?

The SDK compresses images to ~30% of original size before sending. Videos and files are sent at original size. There is no hard limit enforced by the SDK — limits are applied server-side.

What happens if callingView is set to true but the bot does not support calling?

The click-to-call UI is displayed, but calling buttons will be inert since no audio_video_action events will be received from the bot.

How do I customise the UI?

UI customisation is not available in the public API in v1.0. The SDK renders its own complete UI.