TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | Commercial |
ReleasedLast Release | Feb 2017 |
Maintained by Nicolas Lauquin.
Depends on: | |
SocketRocket | = 0.5.1 |
Base64 | = 1.1.2 |
DoYouDreamUp SDK is a simple implementation of the virtual assistant provided by DoYouDreamUp to communicate and echange in real time through a websocket server.
#import <DoYouDreamUp/DoYouDreamUp.h>
[[DoYouDreamUpManager sharedInstance] configureWithDelegate:self
botId:@"972f1264-6d85-4a58-b5ac-da31481dda63"
space:nil
language:@"FR"
testMode:false
solutionUsed:Assistant
pureLivechat:false
serverUrl:@"wss://jp.createmyassistant.com/servlet/chat"
backupServerUrl:nil];
DoYouDreamUpDelegate
protocol and its mandatory methods:///Callback to notify that the connection failed with the given error
///@param error the given error
-(void) dydu_connexionDidFailWithError:(nonnull NSError *)error {}
///Callback to notify that the connection closed correctly
-(void) dydu_connexionDidClosed {}
///Callback to notify that the connection opened
///@param contextId the contextId used in the current connexion
-(void) dydu_connexionDidOpenWithContextId:(nullable NSString*)contextId {}
[[DoYouDreamUpManager sharedInstance] connect];
[[DoYouDreamUpManager sharedInstance] talk:@"Hi, can you help me?"];
-(void) dydu_receivedTalkResponseWithMsg:(nonnull NSString*)message withExtraParameters:(nullable NSDictionary*)extraParameters {}
You are all set to test and use the solution! Build any UI you want around the chat service.
Go to File>New>File.. and add a new header file called `[AppNameHere]-Bridging-Header.h.
#import <DoYouDreamUp/DoYouDreamUp.h>
import DoYouDreamUp
DoYouDreamUpManager.sharedInstance().configureWithDelegate(self,
botId: "972f1264-6d85-4a58-b5ac-da31481dda63",
consultationSpace: nil,
language: "FR",
testMode:true,
solutionUsed: Assistant,
pureLivechat: false,
serverUrl:"wss://jp.createmyassistant.com/servlet/chat",
backupServerUrl:nil)
DoYouDreamUpDelegate
protocol and its mandatory methods:///Callback to notify that the connection failed with the given error
///@param error the given error
func dydu_connexionDidFailWithError(error: NSError) {}
///Callback to notify that the connection closed correctly
func dydu_connexionDidClosed() {}
///Callback to notify that the connection opened
///@param contextId the contextId used in the current connexion
func dydu_connexionDidOpenWithContextId(contextId:String?) {}
DoYouDreamUpManager.sharedInstance().connect()
DoYouDreamUpManager.sharedInstance().talk("Hi, can you help me?"])
Implement the callback delegate:
func dydu_receivedTalkResponseWithMsg(message: String, withExtraParameters extraParameters: [NSObject : AnyObject]?) {}
You are all set to test and use the solution! Build any UI you want around the chat service.
Three demo projects are available in swift & objc. Including:
The recommended way of installation is via CocoaPods a dependency manager for Cocoa projects. Pods lets you download and integrate DoYouDreamUp sdk in your Xcode project in less than 1 minute.
You can install CocoaPods with the following command:
$ gem install cocoapods
CocoaPods 0.39.0+ is required to build DoYouDreamUp 1.0.0+.
To integrate DoYouDreamUp into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'DoYouDreamUp', '~> 1.0.8'
Then, run the following command:
$ pod install
This sdk is a simple wrapper around the DoYouDreamUp websocket interface, something you'll might need to have a look at the interface documention.
No logs are displayed by default except errors, to enable it do:
[DoYouDreamUpManager displayLog:true];