{ "name": "Send Grid", "description": "", "version": "DRAFT", "channelformat": "v2", "type": "channel", "recurrence": 1, "realtimeavailable": false, "enableNewMetadata": true, "auth": { "type": "custom", "authparams": { "key": { "type": "string", "displayname": "API Key" } } }, "methods": [ { "name": "sendEmail", "displayname": "Send Email", "description": "Send an email with your SendGrid account.", "kind": "action", "params": [ { "": { "type": "", "displayname": "" } } ], "input": { "extensible": false, "attributes": [ { "name": "Inputs", "attributes": [ { "name": "To", "type": "string" }, { "name": "From", "type": "string" }, { "name": "Subject", "type": "string" }, { "name": "Body", "type": "string" } ] } ] }, "output": { "extensible": false, "attributes": [ { "name": "Outputs", "attributes": [ { "name": "Sent?", "type": "boolean" } ] } ] }, "zebricks": [ { "brick": "http.post", "id": "POST", "inputs": { "url": { "_availableTypes": [ "string" ], "_type": "string", "_array": false, "_value": "https://api.sendgrid.com/v3/mail/send" }, "body": { "_availableTypes": [ "object", "string" ], "_type": "object", "_array": false, "_value": { "personalizations": [ { "to": [ { "email": "{{input.Inputs.To}}" } ], "subject": "{{input.Inputs.Subject}}" } ], "from": { "email": "{{input.Inputs.From}}" }, "content": [ { "type": "text/plain", "value": "{{input.Inputs.Body}}" } ] } }, "headers": { "_type": "object", "_array": false, "_value": { "Authorization": "Bearer {{auth.key}}", "Content-Type": "application/json" } } }, "outputs": { "statusCode": { "_type": "number", "_array": false }, "body": { "_type": "object", "_array": false } } }, { "brick": "boolean.compare", "id": "COMPARE", "inputs": { "left-operand": { "_availableTypes": [ "string", "number", "Date", "boolean", "object" ], "_type": "string", "_array": false, "_value": "{{POST.statusCode}}" }, "operator": { "_type": "string", "_array": false, "_value": "==" }, "right-operand": { "_availableTypes": [ "string", "number", "Date", "boolean" ], "_type": "number", "_array": false, "_value": 202 } }, "outputs": { "result": { "_type": "boolean", "_array": false } } }, { "brick": "object.construct", "id": "CONSTRUCT", "inputs": { "Outputs": { "Sent?": "{{COMPARE.result}}" } }, "outputs": { "output": { "_type": "object", "_array": false } } } ] } ] }