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); Microphone (only if audio/video calls 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 or audio/video calls. The camera key is also needed for video calls:

<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 = you place the call buttons via getCallingView()
)

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"] ?? "")
    }
}

Call Buttons & Click-to-Call

Two separate things control the calling UI. EnxBotConfiguration.callingView decides where the audio/video call buttons live. The full-screen click-to-call screen is switched on by the bot, not by any configuration flag.

Built-in call buttons (callingView: false, default)

  • Displays the full chat interface (message list + input bar)
  • The container shows its own audio/video call buttons
  • 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

Your own call buttons (callingView: true)

  • The chat interface is the same, but the container hides its built-in call buttons
  • Call EnxChatClient.getCallingView() to get an EnxCallingView (an audio button and a video button) and place it in your own toolbar or navigation bar
  • Tapping a button routes the call into the active EnxBotContainerView, exactly as the built-in buttons would
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)

// Place the call buttons in your navigation bar
let callingView = EnxChatClient.getCallingView()
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: callingView)

Call getCallingView() only after connect(configuration:eventListner:). The returned view reflects that configuration's callingView flag.

Click-to-call screen (started by the bot)

  • When the bot signals a click-to-call session, the input bar is replaced with a full-screen click-to-call interface (EnxClickToCallingView). This happens with either callingView setting
  • Shows a large call button; tapping sends "Hi" to start the bot flow
  • Bot responds with handover status updates displayed on screen
  • When the bot triggers a call, a floating WebView appears with the video/audio session

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

Layered Architecture

Your app talks only to the public API. Below it, the SDK has a view layer that draws the whole chat and calling UI, and a WebView + bridge layer that runs the bot engine and talks to your bot server. Click any diagram on this page to open it at full size.

Layered architecture: host app calls the public API (EnxChatClient), which drives the view layer (EnxBotContainerView), which drives the WebView + bridge layer (EnxBotWebViewManager, WKWebView, EnxBotJSBridgeManager), which talks to the bot server over HTTPS.
Green = this SDK, blue = your app and the bot server. didBotConnected(_:) is delivered back to your app through EnxChatClientDelegate.
LayerResponsibility
Public APIA single static entry point (EnxChatClient) plus the EnxBotConfiguration value object and the EnxChatClientDelegate callback. Your app never touches the view or WebView classes directly.
View layerEnxBotContainerView and its children: the chat list, the input bar with attachments, the click-to-call screen and the floating call container.
WebView + bridge layerEnxBotWebViewManager runs a WKWebView with the bot engine; EnxBotJSBridgeManager (a WKScriptMessageHandler) turns its JavaScript events into Swift callbacks.

Calls run in a WebView. Audio and video calls open in a floating WebView (EnxVideoContainerView). For native EnableX video calls, use the iOS Chatbot UI Kit, which adds a native calling layer on the same chat engine.

Sequence Diagrams

Connecting & messaging

From EnxChatClient.connect() to the bot being ready, then one user message and the bot's reply.

Sequence diagram: connect returns EnxBotContainerView, the app attaches it, the WebView loads the bot engine and reports ready, didBotConnected fires; a user message goes through EnxBotWebViewManager to sendMessageToBot, and the reply comes back through the JS bridge, EnxBotResponseParser and EnxChatListView.
Solid arrows are direct calls; dashed arrows are asynchronous JavaScript → Swift callbacks through EnxBotJSBridgeManager. Messages sent before the bot is ready are queued and sent once it is.

Click-to-call & calls

From the bot signalling a click-to-call session to an active call in the floating call window.

Sequence diagram: the bot signals click-to-call, EnxClickToCallingView replaces the input bar, the user taps the call button which sends Hi, handover status updates are shown, the bot sends audio_video_action and the call opens in EnxVideoContainerView.
The call only starts when the bot sends an audio_video_action event; see What happens if the bot does not support calling?

Component Diagram

This diagram shows internal classes for orientation only. Your app can use only EnxChatClient, EnxBotConfiguration, EnxChatClientDelegate, EnxBotContainerView and EnxCallingView.

Component diagram: EnxChatClient reads EnxBotConfiguration, notifies EnxChatClientDelegate, creates EnxCallingView on request and creates EnxBotContainerView, which owns the child views and EnxBotWebViewManager; the manager owns EnxBotJSBridgeManager, whose payloads go through the parsers into EnxChatMessage.
Green = SDK classes, blue = configuration, delegate, models and parsers. Solid = owns or creates; dotted = notifies, uses or creates on request.

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, shown when the bot signals a click-to-call session
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 the bot does not support calling?

The click-to-call screen never appears, because it is shown only when the bot signals a click-to-call session. Any call buttons (built-in, or from getCallingView()) stay visible but have no effect, since no audio_video_action events will be received from the bot.

Can I run the SDK in the iOS Simulator?

Yes. The XCFramework ships an ios-arm64 slice for devices and an ios-arm64_x86_64-simulator slice. Camera capture still needs a real device.

Are calls native EnableX video sessions?

No. In the SDK, calls run in a floating WebView (EnxVideoContainerView). If you need native EnableX video calls, use the iOS Chatbot UI Kit. See Layered Architecture.

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.