Messaging
Get the Web Push public key (public)
Public read of the VAPID application-server public key a browser needs to subscribe with `pushManager.subscribe({ applicationServerKey })`. This is the one Web Push route that needs no authentication - the public key is designed to be exposed to browser clients. It returns only this project's own key. When the project has not enabled native Web Push, `enabled` is `false` and `publicKey` is `null`.
/api/messaging/projects/{projectId}/messaging/web-push/public-keySDK setup
Create a client instance. No authentication is required for this endpoint.
import { Configuration, MessagingApi } from 'mudbase-sdk';
const configuration = new Configuration({
basePath: 'https://cloud.mudbase.dev',
});
const messaging = new MessagingApi(configuration);import { Configuration, MessagingApi } from 'mudbase-sdk';
const configuration = new Configuration({
basePath: 'https://cloud.mudbase.dev',
});
const messaging = new MessagingApi(configuration);Example request
Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.
const { data: result } = await messaging.getProjectVapidPublicKey("proj_LidzlbM1jLQh");const { data: result } = await messaging.getProjectVapidPublicKey("proj_LidzlbM1jLQh");Playground
liveTest this endpoint with your own credentials. Your requests will be sent to the live API.
No Request Yet
Send a request to see the full inspector
Authentication
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | - |
Responses
Native Web Push enabled
{
"success": true,
"data": {
"enabled": true,
"publicKey": "BJ8example-vapid-public-key-base64url-encoded-application-server-key9xY"
}
}{
"success": true,
"data": {
"enabled": true,
"publicKey": "BJ8example-vapid-public-key-base64url-encoded-application-server-key9xY"
}
}Native Web Push not enabled
{
"success": true,
"data": {
"enabled": false,
"publicKey": null
}
}{
"success": true,
"data": {
"enabled": false,
"publicKey": null
}
}Errors
| Code | Meaning |
|---|---|
404 | - |