SendGrid connector
The SendGrid connector allows you to quickly and easily send emails from your BPMN processes.
Prerequisites​
To use the SendGrid connector a SendGrip API key is needed. Please follow these steps in case you do not have a SendGrid account or API key secret configured in your cluster.
SendGrid connector​
The SendGrid connector comes with two options:
- SendGrid Email Connector allows sending simple emails (i.e. text/plain, text/html).
- SendGrid Email Template Connector supports SendGrid Dynamic Templates.
SendGrid Email Connector​
Create a SendGrid Email Connector Task​
To use this connector, follow the steps below:
- Open Web Modeler and create a new BPMN diagram.
- Add a Task and an EndEvent.
- Click on the Task, click on the wrench icon, and select SendGrid Email Connector. You can also use the search field and type
Sendgrid
.
Alternatively, you can directly create a SendGrid Email Connector by using the append menu:
Make your SendGrid Email Connector executable​
To make the SendGrid Email Connector executable, you need to fill out all the mandatory fields highlighted in red in the properties panel:
- Set SendGrid API Key to
secrets.SEND_GRID_API_KEY
. - Set Sender Name to
Jane Doe
(or the sender identity you configured above). - Set Sender Email to
jane-doe@camunda.com
(or the sender identity you configured above). - Set Receiver Name to
Your Name
. - Set Receiver Email to
Your email address
. - Set Email Content Subject.
- Leave Content Type to text/plain (or alternatively to text/html if you intend to provide an HTML body to your email).
- Provide a text (or HTML) Body for your email.
note
Now you can simply deploy and start a new instance of your process. As with all connectors the run-time is available out of the box in Camunda 8 SaaS.
SendGrid Email Template Connector​
Send an email via SendGrid Dynamic Template and use the Handlebars templating language to pass dynamic values to your connector.
Configure a Dynamic Template​
- Open the Dynamic Transactional Templates page and click Create Template.
- Add a unique template name and click Save.
- To begin editing your new template, click Add Version.
- Select an editor and click Continue.
- Design your template. For more information on using Handlebars, click here.
In our example template we will use the following subject and body:
Subject:
Your Camunda Weather Report for {{location}}
Body:
Hi {{name}},
Thanks for using Camunda Connectors to check your current weather report.
Your current weather in Berlin is {{weather}} with {{actual-temp}}°C and feels like {{feel-temp}}°C
The Camunda Team
In our example template, we will use the following Handlebars:
{{name}}
- the name of the user requesting the weather report
{{location}}
- the location used for the weather report
{{weather}}
- the current weather condition
{{actual-temp}}
- the measured temperature
{{feel-temp}}
- how the temperature feels like in reality
While you are editing your template you can test how your email would look by switching to Preview mode, choosing {} Show Test Data, and then providing the necessary data:
Create a SendGrid Email template Connector task​
To use this connector, follow the steps below:
- Open Web Modeler and create a new BPMN Diagram.
- Add a Task and an EndEvent.
- Click on the Task, click the wrench icon, and select SendGrid Email Template Connector. You can also use the search field and type
Sendgrid
.
Alternatively, you can directly create a SendGrid Email Template Connector by using the append menu:
Make your SendGrid Email Template Connector executable​
To make the SendGrid Email Template Connector executable, fill out all the mandatory fields highlighted in red in the properties panel:
- Set SendGrid API Key to
secrets.SEND_GRID_API_KEY
. - Set Sender Name to
Jane Doe
(or the sender identity you configured above). - Set Sender Email to
jane-doe@camunda.com
(or the sender identity you configured above). - Set Receiver Name to
Your Name
. - Set Receiver Email to
Your email address
. - Log in to your SendGrid account and navigate to the Dynamic Template you created.
- Copy the id of the template and paste it in the Template ID field.
- Provide the test data in the Template Data field as a FEEL context expression:
= {
name: "Jane",
location: "Berlin",
weather: "Clear",
actual-temp: 30,
feel-temp: 3
}
If you want to provide dynamic content in the email via process variables, you can set them in the Template Data field as well:
= {
name: nameVariable,
location: locationVariable,
weather: weatherVariable,
actual-temp: temerature,
feel-temp: windChill
}
note
Now you can simply deploy and start a new instance of your process. As with all connectors the run-time is available out of the box in Camunda 8 SaaS.
Appendix​
Create a SendGrid account​
To use the SendGrid connector, create a free account in SendGrid if you do not have one yet.
- Go to https://signup.sendgrid.com/.
- Set up the account with your email and choose a password.
- Click Create Account.
- Provide further information required by SendGrid.
- Click Get Started.
Create a sender identity​
Before sending your first email, you'll need to create a sender identity and verify it.
- Click Settings > Sender Authentication or click here.
- Choose Verify a Single Sender for demo purposes (or alternatively Authenticate Your Domain for a production setup.)
- Provide the details requested by SendGrid in the form and click Create.
- Go to your email inbox and open the email sent to you by SendGrid.
- Click Verify Single Sender.
Create an API key​
To create an API key in SendGrid, take the following steps:
- Log in to your new account.
- Go to Settings.
- Click API Keys > Create API Key.
- Give your key a name (i.e.
my-camunda-connector-key
). - Click Create Key.
- Copy the API Key and move on to the next step for creating a connector Secret.
Create a new connector Secret​
We advise you to keep your API key safe and avoid exposing it in the BPMN xml
file by creating a Secret:
- Follow our guide for creating Secrets.
- Name your Secret
SEND_GRID_API_KEY
so you can easily reference it later in our connector.