I have scanned a website by OpenAI and it is working in the dashboard. SendBird is initializing in my AppDelegate with no errors but when I run it on the iPhone the bot does not answer questions the same way it works in the dashboard.
I am using SendBird UIKit and pushing the view controller like this
let channelListVC = SBUGroupChannelListViewController()
navigationController?.pushViewController(channelListVC, animated: true)
What am I missing?
Hello, chuckmychart.
Did you create a group channel and invite the bot-id set from the dashboard to converse, and the bot didn’t respond?
I don’t know how to set the botID for the SBUGroupChannelListViewController().
I really want to go directly to the chat, not through a group channel.
To use:
let openChannelVC = SBUOpenChannelViewController()
openChannelVC.channelUrl = "CHANNEL_URL"
navigationController?.pushViewController(openChannelVC, animated: true)
But there doesn;t seem to be any documentation on what the “CHANNEL_URL” should be or if that brings along the botID
I apologize for the late response.
Can you try configuring and executing it as follows?
- AppDeletegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let APP_ID = "~~~~~" // Specify your Sendbird application ID.
let USER_ID = "~~~~~" // User ID
SendbirdUI.initialize(applicationId: APP_ID) { error in
if let error {
print(error.localizedDescription, #function, #file, #line)
}
}
SBUGlobals.currentUser = SBUUser(userId: USER_ID)
SendbirdUI.connect { user, error in
if let error {
print(error.localizedDescription, #function, #file, #line)
}
}
return true
}
- ViewController
let botName = "~~~~~" // your bot id.
let params = GroupChannelCreateParams()
params.userIds = [botName]
params.isDistinct = true
GroupChannel.createChannel(params: params) { channel, error in
if error != nil { return }
guard let channel = channel else { return }
let vc = SBUGroupChannelViewController(channel: channel)
self.navigationController?.pushViewController(vc, animated: true)
}