---
title: Send a Message
slug: web-view-sdk-send-message
createdAt: 2026-11-03T10:14:17.642Z
---

Send a message as the user from your own UI, for example an "Ask about my order" button

::::Tabs
:::Tab{title="iOS"}
```swift
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`
:::

:::Tab{title="Android"}
```kotlin
lifecycleScope.launch {
    try {
        KindlyWebViewSDK.sendMessage("I need help with my order", mapOf("orderId" to "1234")).await()
    } catch (e: KindlyWebViewException.ChatNotReady) {
        KindlyWebViewSDK.launchChat(this@MainActivity)
    }
}
```

Empty text fails with `KindlyWebViewException.InvalidArgument`
:::

:::Tab{title="Flutter"}
```dart
await KindlyWebViewSDK.sendMessage('I need help with my order', newContext: {'orderId': '1234'});
```

Without a chat page it fails with `chatNotReady`. Blank text throws an `ArgumentError`
:::

:::Tab{title="React Native"}
```typescript
await KindlyWebViewSDK.sendMessage('I need help with my order', { newContext: { orderId: '1234' } });
```

Without a chat page it rejects with `CHAT_NOT_READY`. Blank text rejects with `INVALID_ARGUMENT`
:::
::::

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](docId\:Q7UnBbDaHkj-EG0eqRGhl), and follows the same rules
