Integration with Amazon SES
Overview
The following example demonstrates how to send an email via Amazon SES using a AWS API
webhook.
The request is automatically signed with AWS Signature, v4, implemented by this webhook type, which allows submitting requests to any AWS endpoint that accepts AWS Signature, v4.
The example invokes the Amazon SES API SendEmail
action.
Configuration
Create a new AWS API
webhook or import the template used in this example. To import the XML template file, open the Alerts > Outgoing Webhooks page, select Import in the split-button located below the table and complete the upload form.
To create a new webhook, open the Alerts > Outgoing Webhooks page and click Create.
Parameters
Enter a name and specify the following parameters:
Name | Value |
---|---|
Endpoint URL | https://email.<AWS_REGION>.amazonaws.com |
Method | POST |
Content Type | application/x-www-form-urlencoded |
Access Key Id | <AWS_ACCESS_KEY_ID> |
Secret Access Key | <AWS_SECRET_ACCESS_KEY> |
Action | SendEmail |
Modify the Endpoint URL by replacing the <AWS_REGION>
value with your Amazon SES region, for example:
https://email.us-east-1.amazonaws.com
Enter the AWS key id into the Access Key Id field and the secret key into the Secret Access Key field.
Add required parameters for SendMessage
action:
Name | Value |
---|---|
Destination.ToAddresses.member.1 | <DESTINATION_EMAIL> |
Source | <SOURCE_EMAIL> |
Message.Body.Text.Data | <MESSAGE_TEXT> |
Message.Subject.Data | ATSD Alert |
Modify the Destination.ToAddresses.member.1
and Source
by replacing the <DESTINATION_EMAIL>
and <SOURCE_EMAIL>
values with your text.
Modify the Message.Body.Text.Data
by replacing the <MESSAGE_TEXT>
value with your text, for example:
{
"status": "${status}",
"entity": "${entity}",
"rule": "${rule}",
"tags": "${tags}",
"message": ""
}
The MessageBody
text contains placeholders that are substituted with actual values when the webhook is triggered. The placeholders specified in the payload and the URL are visible as editable parameters in the rule editor.
Rule
Create a new rule or import the rule template used in this example. To import the XML template file, open the Alerts > Rules page, select Import in the split-button located below the table and complete the upload form.
To create a new rule, open the Alerts > Rules page and click Create.
Specify the key settings on the Overview tab.
Name | Value |
---|---|
Status | Enabled |
Metric | test_m |
Condition | value > 1 |
Open the Webhooks tab.
Set Enabled to Yes and choose the previously created webhook from the Endpoint drop-down.
Enable Open, Repeat and Cancel triggers.
Specify the text into the Message.Body.Text.Data
and Message.Subject.Data
parameters for all triggers.
Test
Test the integration by submitting a sample series
command on the Data > Data Entry page.
series e:test_e m:test_m=2
The value causes the condition to evaluate to true
, which in turn triggers the webhook.
To verify that an alert is raised, open the Alerts > Open Alerts page and check that an alert for the test_m
metric is present in the Alerts table.
Check the Amazon SES statistics to confirm the delivery of new messages:
Email messages: