Send a Message
Send a message as the user from your own UI, for example an "Ask about my order" button
Task {
do {
try await KindlyWebViewSDK.sendMessage("I need help with my order", newContext: ["orderId": "1234"])
} catch KindlyWebViewError.chatNotReady {
KindlyWebViewSDK.displayChat()
} catch {
// see Errors
}
}Empty text throws KindlyWebViewError.invalidArgument
The message needs a chat page, so show the chat at least once first. It may be hidden since: then the message is sent without showing the chat. While the page is still loading the message waits, up to 30 seconds. Surrounding whitespace is trimmed, and a message can be up to 10,000 characters
newContext goes with this message only, on top of any context set with Context, and follows the same rules