Marketplace
>
amazonSes
fn

amazonSes

v
0.0.2
Latest Version
Likes
0
4
Installations
0
Views
0
24

Overview

Pubpub topic triggerd function to send email via amazon ses.

Usage

# amazonSes amazonSes is pubsub topic triggered firebase cloud function for sending email via Amazon-SES service. ---- ## Required * AWS user with below permission(s). * AmazonSESFullAccess > Learn how to [create user](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html) with specific set of perimissions [here](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html) . ---- ## Installation amazonSes reads AWS credentials from environment variables. You will be asked for the below environment variables during the Installation. * AWS_ACCESS_ID * AWS_SECRET_ACCESS_KEY * AWS_REGION > These values can be found in the access key file of the user. > Learn how to [create access key]((https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey)) for user [here](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey). --- ## How it works amazonSes is a pubsub topic trigger function. It uses pubsub-topic `fn-publish-aws-ses` behind the scene as the trigger to send an email(s). To send an email using amazonSes you need to publish a JSON message to `fn-publish-aws-ses` topic with required fields. # Example ``` javascript const { PubSub } = require("@google-cloud/pubsub"); const pubsub = new PubSub(); const topicFnAwsSes = pubsub.topic("fn-publish-aws-ses"); async function publishAwsSesEmail(payload) { try { await topicFnAwsSes.publishJSON(payload); } catch (error) { console.error("error while publishing message", error) } } const payload = { "from": "jhon@email.com", "to": ["joe@email.com"], "subject": "Test mail", "html": "<b>Hello,</b> Jhon" } publishAwsSesEmail(payload) ``` ----- ## Debugging When the function will fail to send an email, It will generate an error log in cloud logs. You will be able to find error details in the jsonPayload of the log. ``` { insertId: ...., logName: ..., jsonPayload: { // Error details } ... } ``` ------ ## Supported parameters | Parameter | Value | Required | | -----------|-------|----------| | from | "jhon@email.com" | Yes | | to | ["joe@email.com"] | Yes | | subject | "Test email" | Yes | | html | "<b>HTML</b> or Simple text" | Yes | cc | ["jean@email.com"] | Optional | | bcc | ["jean@email.com"] | Optional | | replyTo | "joe@email.com" | Optional | | ref | Message-ID list (an array or space separated string) | Optional | | inReplyto | The Message-ID this message is replying to | Optional _____ ## Need help For any further assistance contact on m.champaneri.20@gmail.com.
Cost
FREE
Cost
Version
0.0.2
Language
JAVASCRIPT
Created At
Updated At
Workspace
fn
Tags
aws-ses
email
pubsub
© 2022 Function Store