Files
paseo/packages/expo-two-way-audio/examples/flow-api
Mohamed Boudra 4cd9e76bd2 Remove unnecessary type assertions across codebase
Add oxlint-tsgolint and configure typescript/no-unnecessary-type-assertion
to flag redundant `!` and `as Foo` casts. Type-aware mode is left off by
default to keep `npm run lint` fast; the rule sits configured for when we
turn type-aware on intentionally. Auto-fix removed ~283 redundant casts;
two manual touch-ups: a real tsgolint false positive in split-container.tsx
and a stale ChildProcess import after a double-cast collapsed.
2026-05-05 19:56:26 +07:00
..

Expo Two-Way-Audio Using Flow API

This example shows how expo-two-way-audio can be used to communicate with Speechmatics Flow API

Flow is a conversational AI API and therefore, we need to send audio data in real time and play back the audio responses that we'll get from the API.

Requirements

A Speechmatics API key is also needed in order to run the example. The key is injected into the app via environment variable. It can be passed by creating a .env file in the same directory as the example with the following content:

EXPO_PUBLIC_SPEECHMATICS_API_KEY='YOUR-API-KEY-HERE'

An API key can be obtained from the Speechmatics Portal

Warning

The example uses the API key to request a temporary token (needed for communicating with flow). In a real-world scenario, you should not expose your API key in your client-side code. Instead, you should create a server-side endpoint that generates the temporary token (JWT) for you.

Run the app

In the examples/flow-api directory:

  1. Install dependencies:

    npm install
    
  2. Run the app:

    # Run iOS
    npm run ios
    
    # Run Android
    npm run android
    

Notes

Some audio features of expo-two-way-audio like Acoustic Echo Cancelling, noise reduction or microphone modes (iOS) don't work on simulator. Run the example on a real device to test these features.

# iOS
npx expo run:ios --device --configuration Release

# Android
npx expo run:android --device --variant release