To integrate YMChatbot into your Xcode project using CocoaPods, specify it in your
Supported iOS versions:
iOS 12, 13 and 14
YMChat framework in the Swift file
After the framework is imported the bot can be presented with few lines as below
YMConfig can be used to set the bot id and other bot related settings. It is recommended to set all appropriate config before starting the bot
botID to initialize. All other settings are optional.
ymAuthenticationToken is used to associate an identity of the user with the chat bot.
Whenever chatbot is launched with ymAuthenticationToken it will load the previous chats associated with this user since inception.
Note: History will load only when
Show history flag is enabled in the channel settings
YMChat supports firebase notifications. Assign your
FCM token to deviceToken
Note: Firebase service account key is required to send notifications. You can share the service account key with us. More info here
Additional information can be passed in the form of key value pair from app to bot using payload.
Payload can be used to pass information from host app to bot. The payload dictionary should be JSON compatible else an error will be thrown
For passing data from bot to app refer bot Bot Events
Payload is securely passed in HTTPS post request to protect the information passed in it
Your on-prem deployment URL can be set to
Speech to text can be enabled by setting the enableSpeech flag. Default value is
If you are adding Speech recognization, add following snippet to Info.plist of the host app
Once the config is set, chat bot can be presented by calling
startChatbot() method and passing your view controller as an argument
Bot events are used to pass information from bot to app. For passing events from app to bot refer Payload
Events from bot can be handled using delegate pattern.
Once the delegate is assigned define the
eventResponse(_:) function. The handler class should conform to
Bot close event is separetly sent and it can be handled in following way. The handler class should conform to
Bot can be programatically closed using
Logging can be enabled to understand the code flow and to fix bugs.
A demo has been created to better understand the integration of SDK in iOS app https://github.com/yellowmessenger/YMChatbot-iOS-DemoApp