Skip to content

Hook Guide

Each hook is one job. Pick the one that matches what you’re building; the SDK hides the plumbing.

For the full signatures, return shapes, and cache semantics, see the package README.

Tells you whether someone’s signed in and gives you a way to sign them in or out. You’ll use this early — probably at your app root, to gate screens behind authentication.

Gives you the list of agents a tenant has. Use this to build an agent picker. The SDK intentionally stays out of selection state — you decide how the user chooses one, and where you store their choice.

The thread list for a tenant, optionally filtered by agent, status, priority, type, and a few others. Most list screens call this one.

A single thread by ID. Use it when you’re rendering a thread detail view and need the title, status, or other metadata.

A number: how many threads have new activity the user hasn’t seen. Use this to drive tab‑bar badges or notification dots without scanning threads yourself.

Make a new thread. Pass a firstMessage and the thread + opening user message get created in one round trip — no need to create then send.

Change something on a thread: mark it read, archive it, change its status. Works for any thread ID — you pass it when you call the function, not when the hook mounts.

All the messages in a thread. Auto‑updates when new ones arrive; you don’t wire subscriptions yourself.

Send a message to a thread. You pass the thread ID at send time, so the same hook works for brand‑new threads and ones that have been mounted forever.

The SDK subscribes for you automatically inside useMessages, but sometimes you want to listen outside a messages list.

Fires when a new message lands on a specific thread. Handy for notifications or typing indicators.

Tenant‑wide stream — fires whenever any thread’s status or title changes. Useful for dashboards.

useThreadTurnSubscription / useThreadTurnUpdatedSubscription

Section titled “useThreadTurnSubscription / useThreadTurnUpdatedSubscription”

Agent turn progress — “is the agent still thinking?”. The first is scoped to one thread; the second is tenant‑wide.


All the data shapes (Thread, Agent, Message, CreateThreadInput, etc.) re‑export from the package root, so you can type your own components against them without digging.

import type { Thread, Agent, Message } from "@thinkwork/react-native-sdk";