npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@realtalk-ai/react-native

v0.1.0

Published

React Native hooks for Real Talk voice and text conversations

Readme

@realtalk-ai/react-native

npm

React Native hooks for Real Talk voice and text conversations. Built on @realtalk-ai/core.

Quick start

npm install @realtalk-ai/react-native @realtalk-ai/core
import { RealTalkProvider, useConversation } from "@realtalk-ai/react-native";

const App = () => {
  return (
    <RealTalkProvider tokenUrl="https://your-server.com/api/token">
      <Chat />
    </RealTalkProvider>
  );
};

const Chat = () => {
  const {
    connectionStatus,
    status,
    messages,
    startConversation,
    endConversation,
  } = useConversation();

  return (
    <View>
      {messages.map((msg) => (
        <Text key={msg.id}>{msg.text}</Text>
      ))}

      {status === "not_started" || status === "finished" ? (
        <Button
          title="Start"
          onPress={() => startConversation({ agentId: "your-agent-id" })}
        />
      ) : (
        <Button title="End" onPress={endConversation} />
      )}
    </View>
  );
};

See the example Expo app for a complete working project.


Setup

Expo

Add the config plugin to your app.json:

{
  "plugins": ["@realtalk-ai/react-native/app.plugin.cjs"]
}

Bare React Native

The native module auto-links. On iOS, run pod install after installing:

cd ios && pod install

Platform permissions

iOS — add to Info.plist:

<key>NSMicrophoneUsageDescription</key>
<string>This app needs microphone access for voice conversations.</string>

Android — add to AndroidManifest.xml:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

The SDK requests this permission at runtime before starting recording.

Token endpoint

The SDK needs a server-side endpoint that you host that creates a session via the Real Talk API and returns a short-lived session token.

@app.get("/api/token")
async def get_token():
    response = await httpx.AsyncClient().post(
        "https://api.realtalk.ml/api/v1/sessions/",
        headers={"X-Realtalk-Api-Key": REALTALK_API_KEY},
        json={"agent_id": REALTALK_AGENT_ID},
    )
    data = response.json()
    return {"token": data["token"], "conversation_id": data["conversation_id"]}

See the example server for a complete implementation.

Provider

Wrap your app with RealTalkProvider and pass your token endpoint:

<RealTalkProvider tokenUrl="https://your-server.com/api/token">
  {children}
</RealTalkProvider>

You can also pass a getToken callback or a custom baseUrl — see the provider source for all options.

useConversation

The main hook — combines connection, messages, and audio controls.

State

| Field | Type | Description | | ------------------ | --------------------------- | ----------------------------------------------------------------------- | | connectionStatus | ConnectionStatus | "disconnected" | "connecting" | "connected" | "reconnecting" | | status | ConversationStatus | "not_started" | "active" | "finished" | | conversationId | string \| null | Current conversation ID | | messages | Message[] | Conversation messages | | error | ConversationError \| null | Current errors | | agentState | AgentState | "idle" | "thinking" | "speaking" | | userState | UserState | "idle" | "speaking" | | volume | number | Audio playback volume (0–1) | | isMicMuted | boolean | Microphone mute state | | isAudioMuted | boolean | Audio output mute state |

Methods

| Method | Description | | ---------------------------- | --------------------------------------- | | startConversation(options) | Start a conversation session | | endConversation() | Send hangup and end the current session | | sendMessage(text) | Send a text message | | sendDTMF(digit) | Send a DTMF tone | | sendEvent(payload) | Send a custom event | | toggleMic() | Toggle microphone mute | | toggleAudio() | Toggle audio output mute | | setVolume(volume) | Set playback volume |

Session options

startConversation({
  agentId: "your-agent-id",
  mode: "voice", // "voice" | "text"
});

Callbacks

useConversation({
  onMessage: (message) => {},
  onError: (error) => {},
  onStatusChange: (status) => {},
  onConnectionStatusChange: (connectionStatus) => {},
  onEvent: (event) => {},
});

The onEvent callback receives server events like message_created, message_updated, vad, and others. Use sendEvent to send custom events to the server. See the core package events reference for the full list of event types and their payloads.

Lower-level hooks

| Hook | Description | | ------------------- | -------------------------------------------------------- | | useConnection | WebSocket transport, session lifecycle, and reconnection | | useMessages | Message array and user/agent state tracking | | useAudioControls | Microphone mute and volume control | | useRealTalkConfig | Access provider configuration from context |

Audio

Audio capture and playback use the RealTalkAudio native module. The AudioRecorder and AudioPlayer classes are exported if you need direct access, but useConversation manages them automatically.

Development

pnpm test         # run tests

License

MIT