---
title: Context
slug: web-view-sdk-context
createdAt: 2026-11-03T10:14:17.339Z
---

Context is a set of key and value pairs that your app attaches to what the user sends, for the bot to use

## Set context

::::Tabs
:::Tab{title="iOS"}
```swift
KindlyWebViewSDK.setNewContext(["plan": "gold"])
```
:::

:::Tab{title="Android"}
```kotlin
KindlyWebViewSDK.setNewContext(mapOf("plan" to "gold"))
```
:::

:::Tab{title="Flutter"}
```dart
await KindlyWebViewSDK.setNewContext({'plan': 'gold'});
```
:::

:::Tab{title="React Native"}
```typescript
KindlyWebViewSDK.setNewContext({ plan: 'gold' });
```
:::
::::

The context goes with the next message, button click or triggered dialogue, and is delivered once. With a chat page loaded it reaches the chat at once, and the chat merges it with context it already holds, so two calls before the next message send both maps. Without a loaded page the SDK keeps only the latest map and delivers it to the next page

Keys and values are strings. A map can hold up to 100 entries, with keys of 1 to 256 characters and values of up to 4,096 characters, and a key cannot be `__proto__`, `constructor` or `prototype`. The SDK refuses a map that breaks these rules with an error in the log. Flutter checks the three reserved keys before the call and throws an `ArgumentError`, and React Native throws a `KindlyWebViewError` with the code `INVALID_ARGUMENT` for them and for a value that is not a string

## Clear context

::::Tabs
:::Tab{title="iOS"}
```swift
KindlyWebViewSDK.clearNewContext()
```
:::

:::Tab{title="Android"}
```kotlin
KindlyWebViewSDK.clearNewContext()
```
:::

:::Tab{title="Flutter"}
```dart
await KindlyWebViewSDK.clearNewContext();
```
:::

:::Tab{title="React Native"}
```typescript
KindlyWebViewSDK.clearNewContext();
```
:::
::::

This withdraws the context set with `setNewContext`, including context the chat page already received

## Context for one message

To attach context to a single message instead, pass it with the message, see [Send a Message](docId:_m000gMTZT87SAZ5w0nB6)
