---
title: Upgrading from 0.1
description: What changed in 0.2 and how to update your app. Short version — a few signatures shifted, one host workaround became unnecessary, and you can do some things in fewer round trips now.
---

If you're on 0.1.x and upgrading, here's what to know. If you're starting fresh, skip this page.

## The short version

- **`useSendMessage` works differently.** You pass the thread ID when you call it, not when you mount the hook.
- **You don't need `useThinkworkMe` anymore.** The SDK handles the fallback internally for Google‑federated users.
- **You can create a thread and send its first message in one call** now.
- **Unread counts come from the server** — you no longer have to scan the thread list yourself.
- **The package lives on public npm.** No more vendored tarballs.

Everything else mostly just works. Here are the specific swaps you'll need to make.

## `useSendMessage` is now unbound

The old version took the thread ID at hook time. The new one takes it at call time. This matters because it means you can send to a thread you just created, without a re‑render in between.

**Before:**

```tsx
const send = useSendMessage(threadId);
await send(text);
```

**After:**

```tsx
const sendMessage = useSendMessage();
await sendMessage(threadId, text);
```

If you want to stamp `senderId` for attribution, pass it as an option:

```tsx
await sendMessage(threadId, text, { senderId: currentUser.id });
```

## `useThinkworkMe` is gone

`useThinkworkAuth().user.tenantId` is now always populated once the user is signed in — even for Google accounts that previously needed the `me` workaround. Delete any host‑side `useThinkworkMe` helper and replace its callers:

**Before:**

```tsx
const { tenantId } = useThinkworkMe();
```

**After:**

```tsx
const { user } = useThinkworkAuth();
const tenantId = user?.tenantId;
```

## One call to create a thread and its first message

The old two‑step pattern went away. Pass `firstMessage` on `createThread`:

**Before:**

```tsx
const thread = await createThread({ tenantId, agentId, title, channel: "CHAT" });
await sendMessage(thread.id, text);
```

**After:**

```tsx
const thread = await createThread({
  tenantId,
  agentId,
  title,
  channel: "CHAT",
  firstMessage: text,
});
```

The backend creates both in one transaction, so there's no orphan‑thread risk if the message fails.

## Unread counts come from the server

If you were fetching threads just to count them:

**Before:**

```tsx
// Your own query + client-side counting logic
const count = countUnread(threads);
```

**After:**

```tsx
const { count } = useUnreadThreadCount({ tenantId, agentId });
```

## New hooks you might want

- `useAgents` — agent list (was likely a host‑side helper before).
- `useThreads` — thread list with filters; replaces raw `useQuery(ThreadsQuery)`.
- `useUpdateThread` — unbound like `useSendMessage`, for marking read / archiving / changing status.
- `useThreadUpdatedSubscription` and `useThreadTurnUpdatedSubscription` — tenant‑wide streams.

## Installing from npm

Drop the vendored tarball and switch to the published package:

```json
{
  "dependencies": {
    "@thinkwork/react-native-sdk": "^0.2.0-beta.2"
  }
}
```

The `beta` dist‑tag tracks the latest pre‑release. When 1.0 ships, `latest` will point at stable.

## What's next

0.3.0 is going to change how the SDK gets its config — instead of build‑time env vars, config will sync down from a Company Settings panel at runtime. Your code doesn't have to change; you just pass the config to `ThinkworkProvider` from whatever source you want. More on that when 0.3.0 ships.
