To show Sarbacane Chat in your iOS app, install the SDK with CocoaPods, then call it with your chatbox's public key. This article is for the app's developer.
A Sarbacane Chat licence assigned to your user, with access to Settings.
An iOS project that uses CocoaPods, targeting iOS 9 or later.
In Sarbacane Chat, at the bottom of the left menu, click Settings. Under Chatbox, open Deploy, then the iOS app tab.
On the right, under Public brand key:, click Copy. The key starts with "spk-".
Important: use the public key. The Secret brand key: must never appear in the app's code.
In your project's Podfile, add the line pod 'XenoApp', then run pod install.
In AppDelegate, in the didFinishLaunchingWithOptions method, import the SDK and prepare the chatbox with your public key:
import XenoApp
Xeno.sharedInstance.prepare(apiKey: "YOUR_PUBLIC_KEY")In the ViewController where the chatbox should appear, in the viewDidLoad method, show it:
Xeno.sharedInstance.show()Note: the SDK and the class use the technical name XenoApp / Xeno. This is expected. With no other setting, each device appears in Sarbacane Chat as a new contact named "Unknown". To pass the identity of the logged-in user, prepare accepts an identity parameter (a dictionary, for example with id and name).
Launch the app and open the view: the chatbox appears. Send a test message: it arrives in Inbox.
Check in this order:
pod install has run, and import XenoApp is present in both files.
prepare is called in AppDelegate, before show().
The key is the public key ("spk-…"), copied without spaces.
show() is called in the view that is actually displayed.
If the problem persists, contact our Sarbacane Chat experts at [email protected].