Warning: This project cannot be used with an Expo Go app because it requires custom native code.
This starter template is designed to help you quickly integrate Vapi into your react native project. It showcases a bot that assists authors in defining characters for their stories, demonstrating the ease of integrating Vapi to manipulate the frontend, display backend results, and leverage other capabilities.
- Real-time Interaction: Interact with the bot in real-time to refine character traits and details.
- Message Handling: Send and receive messages to and from the bot, handling different message types.
- Event Handling: Start, stop, and toggle bot calls with proper event management.
- Clone the repository.
- Install dependencies with
npm install
. - prepare expo build
npx expo prebuild
- Install iOS pods with
npx pod-install
- Set up your
.env
file with the required Vapi tokens. - Run the local server with
npx expo run:ios
.
- Vapi SDK: Integrated via
vapi.sdk.ts
to manage the Vapi instance. - React Hooks:
useVapi.ts
to encapsulate Vapi logic within React components. - Event Listeners: Set up listeners for various Vapi events like speech start/end, call start/end, and message updates.
- Message Components: Render messages and transcripts in real-time as they are received from the bot.
- Character Details: Edit and save character details, which are then sent as messages to the bot for processing.
- update your current existing dependencies in package.json to the exact version as showing below
"expo": "^50",
"react-native": "^0.73.6",
- Add new dependencies to your package.json with exact version as showing below
"@vapi-ai/react-native": "^0.1.6",
"@config-plugins/react-native-webrtc": "8.0.0",
"@daily-co/config-plugin-rn-daily-js": "0.0.4",
"@daily-co/react-native-daily-js": "0.59.0",
"@daily-co/react-native-webrtc": "118.0.3-daily.1",
"@react-native-async-storage/async-storage": "^1.22.3",
"react-native-background-timer": "^2.4.1",
"react-native-get-random-values": "^1.11.0",
- Update app.json
{
"expo": {
...
"ios": {
"supportsTablet": true,
"bundleIdentifier": "co.vapi.DailyPlayground",
"infoPlist": {
"UIBackgroundModes": [
"voip"
]
},
"bitcode": false
}
...
}
...
"plugins": [
"@config-plugins/react-native-webrtc",
"@daily-co/config-plugin-rn-daily-js",
[
"expo-build-properties",
{
"android": {
"minSdkVersion": 24
},
"ios": {
"deploymentTarget": "13.4"
}
}
]
]
}
-
prepare expo build
npx expo prebuild
-
Install iOS pods with
npx pod-install
-
Set up your
.env
file with the required Vapi tokens. -
Run the local server with
npx expo run:ios
.