extensions icon indicating copy to clipboard operation
extensions copied to clipboard

feat(firestore-send-email): Added EventArc handler to send messages

Open DeveloperEnvY opened this issue 2 years ago • 3 comments

  1. Added an event handler for the new Custom Events feature of Firebase extensions to allow the user, or third-party Extensions authorized by the user, to send emails without the need to know the Firestore collection name being monitored by the extension. This would be helpful for other Extensions to send email notifications, for example, the Pangea 'Known Malware Detection' ext can notify the app owner when a user uploads a malicious file to Cloud Storage.

To Send an email:

import {getEventarc} from "firebase-admin/eventarc";

getEventarc().channel().publish({ type: "firebase.extensions.firestore-send-email.v1.onSend", data: { to: "[email protected]", message: { subject: "Hello from Firebase!", text: "This is the plaintext section of the email body.", html: "This is the HTML section of the email body.", }, });

DeveloperEnvY avatar Apr 13 '23 17:04 DeveloperEnvY

HI @DeveloperEnvY

Thanks for the contribution! We already have lifecycle events in the events.ts, do any of these suit the scenario above?

dackers86 avatar Oct 16 '23 09:10 dackers86

Hi @DeveloperEnvY

Apologies, I initially misunderstood, the purpose of this PR.

V2 functions are not yet supported on Extensions, and could require a platform updated to ensure that event arc is correctly initialised on this type of request.

Will keep posted on this update.

dackers86 avatar Oct 18 '23 10:10 dackers86

Hello @DeveloperEnvY, could you please update it with the latest updates from origin/next and fix any failing tests? Thank you!

pr-Mais avatar Jan 17 '24 13:01 pr-Mais