Skip to content

FloatbotAI/floatbot_iOS_sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Floatbot

CI Status Version License Platform

Description

SDK allows the iOS app to integrate with floatbot.ai for iPhone and iPad devices

Prerequisite

• Bot_ID

• Token/Key

You can get Bot_ID and Token for your app from floatbot.ai dashboard

Dependencies

• SDWebImage

• AFNetworking

Requirements

Installation

CocoaPods (recommended)

Floatbot is available through CocoaPods. To install it, simply add the following line to your Podfile:

use_frameworks!
    pod 'floatbot_iOS_sdk'

Required Methods

 FloatbotView.shared.setEncryptionKey(encryptionKeyStr: "YOUR_ENCRYPTION_KEY")

To initialize floatbot user,

FloatbotView.shared.fview(withFrame: CGRect(x:0,y: 0,width:UIScreen.main.bounds.size.width,height: UIScreen.main.bounds.size.height - 300),withViewContainer: self, withbot_id:"5cc00545e6293668180a5d12")

Other helper Methods

To show hide header, use

FloatbotView.shared.showHeader(isVisible: false)

To show user sessions, use

FloatbotView.shared.showSessions()

To Set Authentication token, use

FloatbotView.shared.setToken(tokenStr: "YOUR_AUTH_TOKEN")

To send APNS token to floatbot server to receive push notification, add following method in your project's -[AppDelegate application:didFinishLaunchingWithOptions:] method

FloatbotView.shared.updateToken(pushTokenStr: "YOUR_PUSH_TOKEN")

Uploading your App’s SSL Push Certificate

  1. Go to the Mac OS finder application, and search for “Keychain Access”. Open it.
  2. Find your App’s push certificate in the Certificates section. It will start with the string "Apple Development iOS Push Services" (Apple Production iOS push services” in case of production certificate)
  3. Expand the row, and you will find the private key.
  4. Select both the private key and certificate and export it as .p12 file and necessarily set a password.
  5. Upload the saved .p12 file in the field below selecting development environment or production environment depending on whether you are using it for dev or production push services.

To generate APNS certificate refer this : https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html

Upload your development / production certificate in Settings page.

Floatbot

Handle Push notification

To enable floatbot to send push notifications to the application, add this implementation of - application:didRegisterForRemoteNotificationsWithDeviceToken: in your AppDelegate file that captures the device token and sends it to floatbot server

Add below snippet in Appdelegate.swift file

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.

let notificationTypes: UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
let pushNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)

return true
}

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
...

application.registerUserNotificationSettings(pushNotificationSettings)
application.registerForRemoteNotifications()

return true
}

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
print("DEVICE TOKEN = \(deviceToken)")
}

func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
print(error)
}

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
print(userInfo)
}

Get in touch

For any queries, email us. Email : contact@floatbot.ai

Author

connect@floatbot.ai

License

Floatbot is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published