Asista Chatbot SDK for iOS
Last updated on: May 17th, 2019
Asista chat bot SDK is designed to make it as simple as possible to add chat to your app. You can use the bot to enable users to interact with your service or your product. It lets you integrate an awesome chatbot to your app, along with knowledge base and FAQ support.
Getting Started
Prerequisites
- iOS 9.0+
- Xcode 10.0+
- Swift 4.2+
Integrate chat SDK
There are two ways to import the Asista Bot SDK into your project:
Using Cocoa pods
1. Install Cocoa pods.
From a terminal window navigate into your Xcode project’ application directory and run the following:
sudo gem install
cocoapods
pod init
nano Podfile
Include AsistaBot into your Podfile:
Add the following dependencies to your module’s (app) build.gradle file.
use_frameworks!
platform:ios, '9.0'
target 'Your App' do
pod 'AsistaBot'
end
end
2. Save and close the file
3. Run pod install and build your app.
Using Dynamic frameworks
- Download the chat SDK from our Asista SDK iOS page. The SDK is stored in a compressed file archive named AsistaBot.zip. Unzip the file. You will get a AsistaBot.framework binary.
- Drag and drop the framework file to your Xcode project.
- With your project open in Xcode, select your Target. Under General tab, find Embedded Binaries and then click the + button.
- Click the Add Other… button, navigate to the AsistaBot.framework files and select them. Check the Destination: Copy items if needed checkbox when prompted.
Configure an App in Asista
To begin making calls to the Chat SDK, you need to register for a chat bot on the Asista Web portal and get credentials for your app. Someone with administrator access to Asista must do this. You will get an chatbotUrl and chatBotId after the successful registration of the Bot.
Initializing the SDK
In AppDelegate.swift for your application, just import AsistaBot framework and initialize AsistaBot
Import the AsistaBot framework into the AppDelegate file in your project.
The initialization code snippets look like this:
Swift 4
import AsistaBot
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
AsistaBot.initialize(chatBotUrl: “Chatbot url”, chatBotId: “Your chatbot ID” )
}
To Launch Chat Bot
After successful initialisation you can call AsistaBot.show(on:) to show the bot screen on your app.
Declaration
public func show(on viewController: UIViewController)
Parameter | Type | Description |
---|---|---|
on | UIViewController | Instance of view controller to present the chat bot view |