Skip to main content
DocumentationReact Native
Version 0.2.0React Native 0.76 to below 0.88

React Native SDK: API reference

React Native: A typed bridge to the shared native iOS and Android engines for the selected mobile framework.

On this page

Configuration

DobroDeskSdkConfig

Required

Framework configuration supplies app identity and account scope and obtains a fresh short-lived authorization token from the host credential provider. Token and result shapes follow the displayed platform signature.

DobroDeskSdkConfig
{ apiOrigin: string; integrationId: string; accountScope: string; locale?: SdkLocale; turnstileToken?: string; pollIntervalMs?: number; fetchImpl?: typeof fetch; credentialProvider: () => Promise<{ authorizationToken: string }>; hostActions?: HostActionHandlers; context?: JsonObject }
Errors
  • invalid-config

Lifecycle and conversation

DobroDeskReactNativeClient

Creates the client and validates the integration configuration.

DobroDeskReactNativeClient
new DobroDeskReactNativeClient(nativeModule, config: DobroDeskSdkConfig)

createDobroDeskReactNativeClient

Creates the client and validates the integration configuration.

createDobroDeskReactNativeClient
createDobroDeskReactNativeClient(config: DobroDeskSdkConfig): DobroDeskReactNativeClient

startSession

Starts one conversation with an idempotent initial message.

startSession
startSession(message: string, options?: Omit<SessionStartInput, 'message'>): Promise<Object>
Errors
  • network
  • field-invalid
  • idempotency-conflict
  • outbox-corrupt

resumeSession

Restores account-scoped state or resumes a server session when one exists.

resumeSession
resumeSession(): Promise<Object | null>
Errors
  • network
  • session-expired
  • outbox-corrupt

refresh

Loads the current conversation snapshot.

refresh
refresh(): Promise<Object>
Errors
  • network
  • session-expired
  • message-rejected

waitForAssistant

Polls with bounded timing until assistant work completes or the wait expires.

waitForAssistant
waitForAssistant(options?: Omit<WaitForAssistantOptions, 'pollIntervalMs'>): Promise<Object>
Errors
  • realtime-unavailable
  • network
  • session-expired

sendMessage

Sends a message and returns its accepted, queued or review status.

sendMessage
sendMessage(text: string, idempotencyKey?: string): Promise<Object>
Errors
  • network
  • idempotency-conflict
  • conversation-stale
  • rate-limited
  • message-rejected

flushOutbox

Replays pending mutations with the original body and idempotency key.

flushOutbox
flushOutbox(): Promise<ReadonlyArray<Object>>
Errors
  • network
  • outbox-corrupt
  • session-expired

resetSession

Clears the account-scoped session, snapshot and pending mutations.

resetSession
resetSession(): Promise<void>
Errors
  • request-in-progress
  • outbox-corrupt

setAuthorizationToken

Supplies the latest short-lived token to a native bridge.

setAuthorizationToken
setAuthorizationToken(token: string): Promise<void>

logout

Ends the active customer session and disposes optional capability state.

logout
logout(): Promise<void>
Errors
  • outbox-corrupt

presentWidget

Presents the native widget using the shared widget experience.

presentWidget
presentWidget(options?: NativeWidgetOptions): Promise<void>

Parameters

localeSdkLocale?
The widget locale used for content. Web defaults to auto; native widget bundles currently support en, uk, de and es.
titleString?
Bounded copy overrides for the shared widget copy keys.
subtitleString?
Bounded copy overrides for the shared widget copy keys.
appearanceobject?
The shared appearance-v2 object: colors, typography, layout and shadow within documented bounds.
platformobject?
Platform-specific safe-area, keyboard and navigation overrides within the shared design contract.
reduceMotionboolean?
Use the system setting by default. Native hosts also respect accessibility, low-power and thermal policies.
viewhome | messages | help
Native navigation and web launcher or panel presentation options.
articleIdstring?
Bounded JSON context supplied to explicitly registered host actions.
hostActionIdsstring[]?
Allowlisted application callbacks for guided widget actions. They do not authenticate network requests.
contextJsonObject?
Bounded JSON context supplied to explicitly registered host actions.
Errors
  • invalid-config
  • request-in-progress
  • field-invalid

closeWidget

Closes the current native presentation or releases a mounted host.

closeWidget
closeWidget(): Promise<void>

subscribe

Subscribes to canonical SDK events. Release the listener with the subscription, cancellation callback or stream subscription returned by that platform.

subscribe
subscribe(listener: (event: SdkEvent) => void): () => void

operations

Exposes typed form, client-tool, attachment and commerce operations over the native engine.

operations
operations: DobroDeskRichOperations

submitForm

Submits bounded values for a server-provided conversation form. The request identifier and values are validated before the signed native request is sent.

submitForm
operations.submitForm(requestId: string, values: JsonObject): Promise<JsonValue>

Parameters

requestIdstringRequired
Submits bounded values for a server-provided conversation form. The request identifier and values are validated before the signed native request is sent.
valuesJsonObjectRequired
Submits bounded values for a server-provided conversation form. The request identifier and values are validated before the signed native request is sent.
Returns
Promise<JsonValue>
Errors
  • field-invalid
  • network
  • http
  • session-expired
  • message-rejected

requestClientTool

Requests an allowlisted client tool, acknowledges its result or reads its status. Tool payloads are flat, bounded and reject sensitive field names.

requestClientTool
operations.requestClientTool(input: ClientToolRequest): Promise<JsonValue>

Parameters

inputClientToolRequestRequired
Requests an allowlisted client tool, acknowledges its result or reads its status. Tool payloads are flat, bounded and reject sensitive field names.
Returns
Promise<JsonValue>
Errors
  • field-invalid
  • network
  • http
  • session-expired
  • not_found

completeClientTool

Requests an allowlisted client tool, acknowledges its result or reads its status. Tool payloads are flat, bounded and reject sensitive field names.

completeClientTool
operations.completeClientTool(input: ClientToolResult): Promise<JsonValue>

Parameters

inputClientToolResultRequired
Requests an allowlisted client tool, acknowledges its result or reads its status. Tool payloads are flat, bounded and reject sensitive field names.
Returns
Promise<JsonValue>
Errors
  • field-invalid
  • network
  • http
  • session-expired
  • not_found

clientToolStatus

Requests an allowlisted client tool, acknowledges its result or reads its status. Tool payloads are flat, bounded and reject sensitive field names.

clientToolStatus
operations.clientToolStatus(callId: string): Promise<JsonValue>

Parameters

callIdstringRequired
Requests an allowlisted client tool, acknowledges its result or reads its status. Tool payloads are flat, bounded and reject sensitive field names.
Returns
Promise<JsonValue>
Errors
  • field-invalid
  • network
  • http
  • session-expired
  • not_found

procedureAction

Advances a server-provided procedure action with an idempotency key and the expected workflow revision.

procedureAction
operations.procedureAction(input: ProcedureActionInput): Promise<JsonValue>

Parameters

input.actionstart | answer | availability | select | calendar_date | back | confirm | declineRequired
Advances a server-provided procedure action with an idempotency key and the expected workflow revision.
input.valuestringRequired
Advances a server-provided procedure action with an idempotency key and the expected workflow revision.
input.idempotencyKeystring (16-128 characters)Required
Advances a server-provided procedure action with an idempotency key and the expected workflow revision.
input.procedureId / runId / expectedUpdatedAtstring?
Advances a server-provided procedure action with an idempotency key and the expected workflow revision.
input.locale"en" | "uk" | "de" | "es"?
The widget locale used for content. Web defaults to auto; native widget bundles currently support en, uk, de and es.
input.stepId / parameterId / timeZonestring?
Advances a server-provided procedure action with an idempotency key and the expected workflow revision.
input.nativeCommerceUitrue?
Advances a server-provided procedure action with an idempotency key and the expected workflow revision.
Returns
Promise<JsonValue>
Errors
  • field-invalid
  • network
  • http
  • session-expired
  • message-rejected
  • idempotency-conflict

attachmentIntents

Creates upload intents and uploads selected local files under the SDK size, type, URI and policy limits.

attachmentIntents
operations.attachmentIntents(messageId: string, attachments: readonly AttachmentDescriptor[]): Promise<JsonValue>

Parameters

messageIdstringRequired
Creates upload intents and uploads selected local files under the SDK size, type, URI and policy limits.
attachmentsAttachmentDescriptor[] (1-5; each up to 10 MiB)Required
Creates upload intents and uploads selected local files under the SDK size, type, URI and policy limits.
Returns
Promise<JsonValue>
Errors
  • field-invalid
  • network
  • http
  • session-expired
  • attachment_policy_failed
  • attachment_rate_limited

uploadAttachment

Creates upload intents and uploads selected local files under the SDK size, type, URI and policy limits.

uploadAttachment
operations.uploadAttachment(intent: AttachmentUploadIntent, fileUri: string, mimeType: string): Promise<JsonValue>

Parameters

intentAttachmentUploadIntentRequired
Creates upload intents and uploads selected local files under the SDK size, type, URI and policy limits.
fileUristring (file:// or content:// URI)Required
Creates upload intents and uploads selected local files under the SDK size, type, URI and policy limits.
mimeTypestringRequired
Creates upload intents and uploads selected local files under the SDK size, type, URI and policy limits.
Returns
Promise<JsonValue>
Errors
  • field-invalid
  • network
  • http
  • session-expired
  • attachment_policy_failed
  • attachment_rate_limited

listOrders

Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.

listOrders
operations.listOrders(query?: CommerceOrderQuery): Promise<JsonValue>

Parameters

queryCommerceOrderQuery
Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.
Returns
Promise<JsonValue>
Errors
  • field-invalid
  • network
  • http
  • session-expired
  • commerce_identity_required
  • commerce_unavailable
  • shopify_reconnect_required
  • shopify_rate_limited

orderDetail

Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.

orderDetail
operations.orderDetail(orderRef: string): Promise<JsonValue>

Parameters

orderRefstringRequired
Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.
Returns
Promise<JsonValue>
Errors
  • field-invalid
  • network
  • http
  • session-expired
  • commerce_identity_required
  • commerce_unavailable
  • not_found

createCommerceProposal

Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.

createCommerceProposal
operations.createCommerceProposal(input: CommerceProposalInput, idempotencyKey: string): Promise<JsonValue>

Parameters

inputCommerceProposalInputRequired
Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.
idempotencyKeystring (16-128 characters)Required
Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.
Returns
Promise<JsonValue>
Errors
  • field-invalid
  • network
  • http
  • session-expired
  • commerce_identity_required
  • commerce_unavailable
  • shopify_reconnect_required
  • shopify_rate_limited
  • idempotency-conflict

confirmCommerceProposal

Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.

confirmCommerceProposal
operations.confirmCommerceProposal(proposalId: string, idempotencyKey: string): Promise<JsonValue>

Parameters

proposalIdstringRequired
Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.
idempotencyKeystring (16-128 characters)Required
Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.
Returns
Promise<JsonValue>
Errors
  • field-invalid
  • network
  • http
  • session-expired
  • commerce_identity_required
  • commerce_unavailable
  • shopify_reconnect_required
  • shopify_rate_limited
  • not_found
  • idempotency-conflict

commerceProposal

Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.

commerceProposal
operations.commerceProposal(proposalId: string): Promise<JsonValue>

Parameters

proposalIdstringRequired
Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.
Returns
Promise<JsonValue>
Errors
  • field-invalid
  • network
  • http
  • session-expired
  • commerce_identity_required
  • commerce_unavailable
  • not_found

ClientToolRequest

Requests an allowlisted client tool, acknowledges its result or reads its status. Tool payloads are flat, bounded and reject sensitive field names.

ClientToolRequest
{ toolName: string; basisMessageId: string; input: ClientToolPayload }

ClientToolResult

Requests an allowlisted client tool, acknowledges its result or reads its status. Tool payloads are flat, bounded and reject sensitive field names.

ClientToolResult
{ callId: string; output: ClientToolPayload }

AttachmentDescriptor

Creates upload intents and uploads selected local files under the SDK size, type, URI and policy limits.

AttachmentDescriptor
{ clientId: string; fileName: string; mimeType: string; sizeBytes: number; kind: AttachmentKind }

AttachmentUploadIntent

Creates upload intents and uploads selected local files under the SDK size, type, URI and policy limits.

AttachmentUploadIntent
{ clientId: string; attachmentId: string; uploadUrl: string; uploadToken: string; expiresAt: string }

CommerceProposalInput

Reads scoped order data and creates, confirms or reads a bounded Shopify order-cancellation proposal.

CommerceProposalInput
{ actionId: "shopify_order_cancel"; selection: { storeReference: string; orderReference: string; lineItems?: { lineItemReference: string; quantity: number }[] } }

DobroDeskLoadingState

The shared loading state is one of idle, starting-session, loading-messages, sending-message, waiting-for-assistant, executing-action, reconnecting or flushing-outbox.

DobroDeskLoadingState
"idle" | "starting-session" | "loading-messages" | "sending-message" | "waiting-for-assistant" | "executing-action" | "reconnecting" | "flushing-outbox"

SdkEvent

Native and wrapper events use the shared loading, session, snapshot, accepted-message, error and session-cleared envelope.

SdkEvent
loading(state: DobroDeskLoadingState) | session-cleared | session-started | snapshot | message-accepted | error | host-action-requested | host-action-cancelled

Widget presentation

WidgetExperience

The shared appearance-v2 object: colors, typography, layout and shadow within documented bounds.

WidgetExperience
schemaVersion, locale, appearance, platformOverrides, presentation, reducedMotion, copy
Errors
  • field-invalid
  • unsupported

DobroDeskWidgetView

Presents the native widget using the shared widget experience.

DobroDeskWidgetView
<DobroDeskWidgetView client={client} options?: NativeWidgetOptions visible?: boolean style?: ViewStyle onError?: (error) => void loadingBuilder?: () => ReactNode errorBuilder?: (error, retry) => ReactNode />

createInlineWidgetOwner

Presents the native widget using the shared widget experience.

createInlineWidgetOwner
createInlineWidgetOwner(): DobroDeskInlineWidgetOwner

prepareInlineWidget

Presents the native widget using the shared widget experience.

prepareInlineWidget
prepareInlineWidget(options?: NativeWidgetOptions, owner?: DobroDeskInlineWidgetOwner): Promise<{ config; widget; lease: DobroDeskInlineWidgetLease }>
Errors
  • invalid-config
  • request-in-progress
  • field-invalid

releaseInlineWidget

Closes the current native presentation or releases a mounted host.

releaseInlineWidget
releaseInlineWidget(ownerOrLease?: DobroDeskInlineWidgetOwner | DobroDeskInlineWidgetLease): Promise<void>

NativeOperation (wrapper bridge)

Exposes typed form, client-tool, attachment and commerce operations over the native engine.

NativeOperation (wrapper bridge)
operation: "complete-host-action" | "request-client-tool" | "complete-client-tool" | "client-tool-status" | "submit-form" | "procedure-action" | "attachment-intents" | "upload-attachment" | "list-orders" | "order-detail" | "create-commerce-proposal" | "confirm-commerce-proposal" | "commerce-proposal"

complete-host-action (local bridge)

Framework wrappers encode host-action completion through a local native presenter bridge. It is not sent as an HTTP operation through the direct native client.

complete-host-action (local bridge)
{ operation: "complete-host-action"; requestId: string; actionId: string; result: HostActionResult }

Parameters

requestIdstringRequired
Allowlisted application callbacks for guided widget actions. They do not authenticate network requests.
actionIdstringRequired
Allowlisted application callbacks for guided widget actions. They do not authenticate network requests.
resultHostActionResultRequired
Allowlisted application callbacks for guided widget actions. They do not authenticate network requests.
Returns
JsonValue
Errors
  • field-invalid
  • session-expired
  • unsupported

Optional capabilities

attachVoice

Attaches a separately installed, host-owned voice capability.

attachVoice
attachVoice(port: DobroDeskVoicePort): Promise<DobroDeskVoiceFacade>
Errors
  • unsupported
  • invalid-config

voice

Controls an optional host-installed voice capability: start, stop, mute, barge-in and disposal. The browser widget may render voice UI, but this SDK API controls only a host-provided voice bridge.

voice
voice: DobroDeskVoiceFacade | undefined

createReactNativeVoicePort

Attaches a separately installed, host-owned voice capability.

createReactNativeVoicePort
createReactNativeVoicePort(bridge): DobroDeskVoicePort

voice lifecycle

Controls an optional host-installed voice capability: start, stop, mute, barge-in and disposal. The browser widget may render voice UI, but this SDK API controls only a host-provided voice bridge.

voice lifecycle
start(): Promise<void>; stop(): Promise<void>; setMuted(muted: boolean): Promise<void>; bargeIn(): Promise<void>; dispose(): Promise<void>
Errors
  • invalid-configuration
  • permission-denied
  • audio-unavailable
  • session-expired
  • realtime-unavailable
  • invalid-response
  • protocol-violation
  • stale-frame
  • queue-overloaded
  • cancelled
  • unsupported

push module (native only)

Describes the separate opt-in native push artifact and host registration flow. Framework wrappers do not export a JavaScript or Dart push client; use the iOS or Android native module.

push module (native only)
No JS/Dart wrapper export; use the iOS DobroDeskPush product or Android com.dobrodesk:dobrodesk-push:<version>.

Errors

SdkErrorCode

Handle stable machine-readable codes and keep server diagnostics out of customer UI.

SdkErrorCode
invalid-config | network | http | integration-disabled | integration-paused | origin-not-allowed | turnstile-required | turnstile-failed | request-in-progress | idempotency-conflict | conversation-limit-reached | rate-limited | payload-too-large | field-invalid | conversation-stale | session-expired | realtime-unavailable | message-rejected | outbox-corrupt | unsupported