Socket
Book a DemoInstallSign in
Socket

@google-cloud-suite/firebase-functions-sendgrid-contact

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud-suite/firebase-functions-sendgrid-contact

@google-cloud-suite/firebase-functions-sendgrid-contact

npmnpm
Version
0.0.30
Version published
Maintainers
1
Created
Source

@google-cloud-suite/firebase-functions-sendgrid-contact

Send email by sendgrid

  • Install
npm install @google-cloud-suite/firebase-functions-sendgrid-contact
  • Handle http trigger

You can use handle(params?: InitParams) to initialize trigger. The followings are the property of InitParams:

  • apiKey: string
  • emailFrom: string
  • emailTo: string
  • defaultSubject?: string
  • reply?: { defaultSubject?: string }
    • if reply is not set, reply message is not sent.

Examples:

const sendgridContact = require("@google-cloud-suite/firebase-functions-sendgrid-contact");
exports.createContact = sendgridContact.handle({
   apiKey: "sgapikey",
   emailFrom: "no-reply@example.org",
   emailTo: "you@example.org",
   defaultSubject: "Message from customer",
   reply: { defaultSubject: "Thank you for your contact!" }
});
  • Call function
import { getFunctions, httpsCallable } from "firebase/functions";

const functions = getFunctions();
const createContact = httpsCallable(functions, "createContact");

contact body = "Hello, I have a question.";
createContact({ body })
  .then((result) => {
    alert("success");
  });

// If you want to reply thanks email to your customer
createContact({ body, replyBody: "You sent: " + body, replyTo: "customer@example.org"})
  .then((result) => {
    alert("success");
  });

  • Deploy
firebase deploy

FAQs

Package last updated on 30 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts