Run a Studio peer directly inside a mobile app so it can answer users and trigger native app actions such as screen navigation, camera capture, and task execution.
A common mobile pattern is not just chat. It is a peer living inside the app and helping the user complete tasks without leaving the native flow. For example, a field sales app can expose a Studio peer that drafts follow-up messages, opens account screens, or starts a visit summary workflow.
This keeps Studio focused on peer behavior while your mobile app remains responsible for device capabilities and navigation.
When to reach for this recipe
If your team needs the capabilities described above and you'd rather build on proven primitives than wire one from scratch — this is the shape to start from.
Architecture
Client SDK works in browser and Node-style environments, making it suitable for React Native bridges or mobile web shells. The peer comes from Studio, but the app decides which native actions are safe to expose as client tools.
Typical client tools in mobile include opening a screen, scanning a barcode, capturing a photo, or saving a draft locally for offline sync.
1. Initialize The Mobile Integration
Create the client in your mobile app shell and fetch the peer bound to the app channel.
1import{CognipeerClient}from'@cognipeer/sdk';
2
3constclient=newCognipeerClient({
4token: mobileSession.cognipeerToken,
5hookId: mobileSession.channelHookId,
6apiUrl:'https://api.cognipeer.com/v1',
7});
8
9constpeer=await client.peers.get();
10console.log('Connected mobile peer:', peer.name);
2. Map Native Capabilities As Client Tools
The peer can now decide when to invoke native functionality without owning that logic itself.
1constmobileTools=[
2{
3type:'function',
4function:{
5name:'openCustomerDetailScreen',
6description:'Navigate to a customer detail screen inside the mobile app',
13messages:[{role:'user',content:'Attach the latest visit photo as well.'}],
14clientTools: mobileTools,
15});
16
17console.log(nextTurn.content);
Result
You get a mobile-native assistant that:
- Keeps the Studio peer inside your app experience
- Calls native device capabilities through client tools
- Guides users through real app tasks instead of standalone chat
- Works well for field teams, sales reps, ops users, and task-heavy mobile flows