Boot Retry Handler for React Native
Updated
The boot retry handler is an optional callback that the host app can register with the Sprinklr Messenger SDK. It is invoked when Messenger fails to boot and the user taps Retry on the boot error screen.
By default, retry re‑runs takeOff with the last settings stored in memory. This works for temporary issues (such as network interruptions or server downtime), but it cannot resolve problems caused by stale data (for example, an expired user hash). The boot retry handler allows the host app to take control of the retry flow and refresh data when needed.
API
MessengerClient.registerBootRetryHandler(handler: () => Promise<boolean>): void;
Handler Response
The handler must indicate whether it took responsibility for the retry:
Response | Meaning | SDK Behavior |
Handled (true / YES) | The host app has performed (or will perform) the recovery. For example, called updateUser with fresh credentials. | SDK does not call takeOff again. The host app is expected to have triggered boot through its own action (typically updateUser, which internally re-run takeOff). |
Not handled (false / NO) | The host app cannot or does not want to intervene. | SDK falls back to takeOff with the last known settings, same as having no handler at all. |
Implementation
import MessengerClient from '@sprinklrjs/chat-native-client';const bootRetryHandler = async () => {const updatedUser = await getUpdatedUser();if (updatedUser) {MessengerClient.updateUser(updatedUser);return true;}return false;};// During app initialization:MessengerClient.registerBootRetryHandler(bootRetryHandler);