CA

What does this PR do?

This PR implements web push notifications for cal.com.

Fixes #14504 /claim #14504

https://www.loom.com/share/3e12532ba0be4214bdb827d319acb430?sid=d38fc961-14d0-4681-8d14-30b46faae927

Requirement/Documentation

  • This would require documentation for self-hosting as this requires 2 new env variables.
  • I have not yet created any document for this as I will need to discuss few things with a maintainer and then I can document all these changes.

Type of change

  • New feature (non-breaking change which adds functionality)

How should this be tested?

  • Create a new public-private key pair required for web push notifications using npx web-push generate-vapid-keys.
  • Add these keys in .env file NEXT_PUBLIC_VAPID_PUBLIC_KEY and VAPID_PRIVATE_KEY.
  • Book meeting with event that requires confirmation. The notification will be received to the organizer.
  • Caution: The web push notifications doesn’t work in all the browsers. The chrome and firefox supports it fully as of now as per my research.

Edit (By Udit):-

  • Execute ngrok http 3000 and use that url
  • Go to /bookings page and click on ‘Allow Notification’.
  • then add sendNotification'(packages/features/notifications/sendNotification.ts) anywhere like in handleNewBooking. use the subscription` value from prisma studio NotificationsSubscription table.

You should see notification like this

Screenshot 2024-08-22 at 2 45 11 PM

Checklist

  • I haven’t added tests that prove my fix is effective or that my feature works

Claim

Total prize pool $50
Total paid $50
Status Approved
Submitted May 06, 2024
Last updated September 02, 2024

Contributors

PR

Pradip Chaudhary

@ChaudharyPradip

100%

Sponsors

CA

Cal.com, Inc.

@cal

$50 paid