Skip to content

Commit 8baa96e

Browse files
committed
deeplinks first pass review
1 parent 938b030 commit 8baa96e

2 files changed

Lines changed: 121 additions & 1 deletion

File tree

docs/docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,8 @@
466466
"pages": [
467467
"mini-apps/technical-guides/sign-manifest",
468468
"mini-apps/technical-guides/dynamic-embeds",
469-
"mini-apps/technical-guides/neynar-notifications"
469+
"mini-apps/technical-guides/neynar-notifications",
470+
"mini-apps/technical-guides/deeplinks"
470471

471472
]
472473
},
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
title: 'Deeplinks for Agent Interactions'
3+
description: 'Use deeplinks to create seamless user flows between group and private conversations within Base App.'
4+
sidebarTitle: 'Deeplinks'
5+
---
6+
7+
Deeplinks enable seamless navigation within Base App, allowing you to create more engaging and intuitive user experiences. Deeplinks enable you to directing users to start a private conversation with an agent or a group chat.
8+
9+
## Implementation
10+
11+
Create a button that invites a user to join a group chat
12+
13+
<Steps>
14+
<Step title="Create a conversation ID">
15+
16+
XMTP stuff -- reference:
17+
18+
might need to update `group` to `conversation` / `conversationID`
19+
```typescript CreateGroupChat.tsx
20+
const group = await client.conversations.newGroup(
21+
[bo.inboxId, caro.inboxId],
22+
);
23+
```
24+
25+
</Step>
26+
<Step title="Use the openUrl hook">
27+
28+
Use `sdk.actions.openUrl()` to safely navigate a user to a group chat.
29+
30+
31+
```typescript ChatButtonComponent.tsx highlight={19, 36-42}
32+
import { useState } from 'react';
33+
34+
interface DeeplinkButtonProps {
35+
conversationID: string;
36+
label?: string;
37+
className?: string;
38+
}
39+
40+
export function DeeplinkButton({
41+
conversationID,
42+
label = "Direct Message",
43+
className = "btn-primary"
44+
}: DeeplinkButtonProps) {
45+
const [isLoading, setIsLoading] = useState(false);
46+
47+
const handleDeeplink = async () => {
48+
setIsLoading(true);
49+
try {
50+
const deeplink = `cbwallet://messaging/${conversationID}`;
51+
52+
// Check if running in supported environment
53+
if (typeof window !== 'undefined') {
54+
window.location.href = deeplink;
55+
} else {
56+
// Fallback for server-side rendering
57+
console.warn('Deeplink not supported in this environment');
58+
}
59+
} catch (error) {
60+
console.error('Failed to open deeplink:', error);
61+
} finally {
62+
setIsLoading(false);
63+
}
64+
};
65+
66+
return (
67+
<button
68+
onClick={handleDeeplink}
69+
disabled={isLoading}
70+
className={className}
71+
>
72+
{isLoading ? 'Opening...' : label}
73+
</button>
74+
);
75+
}
76+
```
77+
78+
79+
</Step>
80+
<Step title="Third Step">
81+
These are instructions or content that only pertain to the third step.
82+
</Step>
83+
</Steps>
84+
85+
86+
## Schema
87+
88+
### Group Messages
89+
90+
Create a direct link to a group chat
91+
92+
```
93+
cbwallet://messaging/${conversationID}
94+
```
95+
96+
### Parameters
97+
98+
<ResponseField name="conversationID" type="string" required>
99+
The unique identifier for a XMTP chat
100+
</ResponseField>
101+
102+
103+
104+
### Direct Message (User or Agents)
105+
106+
Create a direct link to message an agent or user
107+
108+
```
109+
cbwallet://messaging/${address}
110+
```
111+
112+
### Parameters
113+
114+
<ResponseField name="address" type="string" required>
115+
The 0x address of the user or agent you want to chat with (in hex format, e.g., `0xabc...1234`)
116+
</ResponseField>
117+
118+
119+

0 commit comments

Comments
 (0)