feat(firestore-send-email): Added EventArc handler to send messages
- 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.",
},
});
HI @DeveloperEnvY
Thanks for the contribution! We already have lifecycle events in the events.ts, do any of these suit the scenario above?
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.
Hello @DeveloperEnvY, could you please update it with the latest updates from origin/next and fix any failing tests? Thank you!