You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* usenotif hook depreciated
* updated warning
* removed
* switched call out
* added async to switch statement
* added async to switch statement
* added async to switch statement
* added async to switch statement
* removed await from both save notification and client behaviour
* added moved under overview
* added bold
Copy file name to clipboardExpand all lines: docs/mini-apps/core-concepts/notifications.mdx
+34-10Lines changed: 34 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,12 +13,25 @@ To send a notification, make a `POST` request to the `url` with the user's notif
13
13
14
14
You will receive webhook events when users enable or disable notifications for your app. When disabled, the notification token becomes invalid and should no longer be used.
15
15
16
+
## Client App Behavior
17
+
18
+
Different client apps handle webhook responses differently:
19
+
20
+
**Farcaster app**: Activates notification tokens immediately without waiting for a webhook success response.
21
+
22
+
**Base app**: Waits for a successful webhook response before activating tokens.
23
+
24
+
<Note>
25
+
If your webhook processes token saving and sends notifications synchronously before returning a response, tokens may work on Farcaster but fail to activate on Base app.
Notification tokens are unique to each client app. This means a user can have separate notification preferences for your Mini App across different clients (e.g., Farcaster, the Base app). Removing your Mini App in one client does not affect its status in other clients.
21
33
</Info>
34
+
22
35
</Panel>
23
36
## Implementation
24
37
<Steps>
@@ -54,19 +67,21 @@ Notification tokens are unique to each client app. This means a user can have se
54
67
// Return appropriate error responses with status codes 400, 401, or 500
55
68
}
56
69
70
+
57
71
// Extract webhook data
58
72
59
73
const fid =data.fid;
60
74
const appFid =data.appFid; // The FID of the client app that the user added the Mini App to
61
75
const event =data.event;
62
76
63
-
// Handle different event types
77
+
// Handle different event types
78
+
79
+
try {
64
80
switch (event.event) {
65
81
case"miniapp_added":
66
-
// Save notification details and send welcome notification
<Steptitle="Add the Webhook URL to your manifest">
@@ -129,6 +147,11 @@ Notification tokens are unique to each client app. This means a user can have se
129
147
<Steptitle="Prompt users to add your Mini App">
130
148
Use the `addMiniApp()` hook to prompt users to add your Mini App
131
149
150
+
<Warning>
151
+
**Important: Webhook Response Timing**
152
+
Webhooks must respond within 10 seconds to avoid timeouts from the Base app. If you encounter a "Failed to add mini app" error, your webhook may be taking too long to respond.
153
+
</Warning>
154
+
132
155
```tsx page.tsx highlight={11, 25-27}
133
156
"use client";
134
157
@@ -343,3 +366,4 @@ Sent when a user disables notifications from, e.g., a settings panel in the clie
Copy file name to clipboardExpand all lines: docs/onchainkit/latest/components/minikit/hooks/useNotification.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,9 @@ description: Send notifications via a backend proxy to users who saved your Mini
6
6
Defined in [@coinbase/onchainkit](https://github.com/coinbase/onchainkit)
7
7
8
8
<Warning>
9
-
Notifications are not yet available in Base App but are coming soon. This documentation describes the upcoming API that will be available when notifications are fully deployed.
9
+
This hook is now deprecated. Please follow the [Notifications Guide](/mini-apps/core-concepts/notifications) for implementation.
10
10
</Warning>
11
-
ebcbglkhecg
11
+
12
12
13
13
<Info>
14
14
Allows Mini Apps to send push notifications to users who have saved your app. Notifications require a backend proxy route to handle the actual delivery and enforce rate limiting.
0 commit comments