festval-notification-sdk
v1.3.0
Published
SDK TypeScript para integração com a API de notificações Festval.
Maintainers
Readme
Festval Notification SDK
SDK TypeScript para consumir a API de notificações e web push da Festval.
Instalação
npm install festval-notification-sdkNotificações
import { WebPushNotification } from "festval-notification-sdk";
const notifications = new WebPushNotification("minha-aplicacao", {
host: "https://api.exemplo.com",
});
await notifications.send(["[email protected]"], {
title: "Novo aviso",
body: "Você recebeu uma notificação.",
type: "INFO",
url: "/notificacoes",
});
const unread = await notifications.notifications("[email protected]");
await notifications.markAsRead(unread[0].id);
await notifications.markAllAsRead("[email protected]");Web push
import { WebPushSubscription } from "festval-notification-sdk";
const subscriptions = new WebPushSubscription({
host: "https://api.exemplo.com",
});
const { publicKey } = await subscriptions.getPublicKey();
await subscriptions.subscribe("[email protected]", {
subscription: {
endpoint: "https://push-service.example/subscription-id",
keys: {
p256dh: "...",
auth: "...",
},
},
});O host padrão é http://localhost:3333. Um AxiosInstance também pode ser
informado em httpClient para configurar interceptors ou autenticação.
Desenvolvimento e publicação
npm test
npm run build
npm pack --dry-run
npm login
npm publish