Send push notification
Send a push notification to a user or a group of users.
Send a notification to everyone in an experience.
Make sure you have setup your whop SDK client on the server
See the full list of accepted parameters here.
Adding a deeplink to the notification.
When you send a notification, you will usually want to send the user to specific section in your app upon clicking the notification.
You can do this by using the restPath
property.
-
Update your app path in the dashboard to handle the additional parameters.
In the hosting section, set the “App path” field to something like:
/experiences/[experienceId]/[restPath]
-
In your
sendPushNotification
call, add therestPath
property. -
Update you app to handle the following route:
When clicking on a notification, the user will open this specific url on your app within the whop iframe.
If using NextJS, you can add a
page.tsx
file with the path:app/experiences/[experienceId]/posts/[postId]/page.tsx
Note: the exact path will depend on the pathname structure you set in the
restPath
property.
Sending a notification to company admins
Your app may want to alert company admins only, not all members. Use the companyTeamId
field instead of the experienceId
when sending the notification.
You must send either the companyTeamId
or the experienceId
when sending a
notification. Setting both will result in an error.
Sending a notification to a specific subset of users.
Use the userIds
field to filter the users who will receive the notification.
Whop will first apply either the experienceId
or the companyTeamId
filter and then apply the userIds
filter
Ensure that the userIds
array contains valid user IDs that are part of the specified experience or company team.
For example if you a building a bidding app you may want to alert the highest bidder if they were just outbid.