Minor update to remove send grid from the API component of the builder and make them part of the automation itself.

This commit is contained in:
mike12345567 2020-10-05 17:45:31 +01:00
parent 987ec93b56
commit f3c4144072
3 changed files with 7 additions and 14 deletions

View File

@ -5,7 +5,7 @@
import posthog from "posthog-js" import posthog from "posthog-js"
import analytics from "analytics" import analytics from "analytics"
let keys = { budibase: "", sendGrid: "" } let keys = { budibase: "" }
async function updateKey([key, value]) { async function updateKey([key, value]) {
if (key === "budibase") { if (key === "budibase") {
@ -42,14 +42,6 @@
value={keys.budibase} value={keys.budibase}
label="Budibase" /> label="Budibase" />
</div> </div>
<div class="background">
<Input
on:save={e => updateKey(['sendgrid', e.detail])}
thin
edit
value={keys.sendgrid}
label="Sendgrid" />
</div>
</div> </div>
<style> <style>

View File

@ -7,7 +7,6 @@ exports.fetch = async function(ctx) {
ctx.status = 200 ctx.status = 200
ctx.body = { ctx.body = {
budibase: process.env.BUDIBASE_API_KEY, budibase: process.env.BUDIBASE_API_KEY,
sendgrid: process.env.SENDGRID_API_KEY,
userId: process.env.USERID_API_KEY, userId: process.env.USERID_API_KEY,
} }
} }

View File

@ -1,7 +1,3 @@
const environment = require("../../environment")
const sgMail = require("@sendgrid/mail")
sgMail.setApiKey(environment.SENDGRID_API_KEY)
module.exports.definition = { module.exports.definition = {
description: "Send an email", description: "Send an email",
tagline: "Send email to {{inputs.to}}", tagline: "Send email to {{inputs.to}}",
@ -13,6 +9,10 @@ module.exports.definition = {
schema: { schema: {
inputs: { inputs: {
properties: { properties: {
apiKey: {
type: "string",
title: "SendGrid API key",
},
to: { to: {
type: "string", type: "string",
title: "Send To", title: "Send To",
@ -49,6 +49,8 @@ module.exports.definition = {
} }
module.exports.run = async function({ inputs }) { module.exports.run = async function({ inputs }) {
const sgMail = require("@sendgrid/mail")
sgMail.setApiKey(inputs.apiKey)
const msg = { const msg = {
to: inputs.to, to: inputs.to,
from: inputs.from, from: inputs.from,