Hey, no problem. This is a lift from the SendGrid docs, it shows the CURL call.
curl --request POST \
--url https://api.sendgrid.com/v3/mail/send \
--header 'Authorization: Bearer <<YOUR_API_KEY>>' \
--header 'Content-Type: application/json' \
--data '{"personalizations":[{"to":[{"email":"john.doe@example.com","name":"John Doe"}],"subject":"Hello, World!"}],"content": [{"type": "text/plain", "value": "Heya!"}],"from":{"email":"sam.smith@example.com","name":"Sam Smith"},"reply_to":{"email":"sam.smith@example.com","name":"Sam Smith"}}'
That 's from this page Getting started with the SendGrid API | Twilio
The webhook example in the readme for Dozer, is pretty much all you need. The --data
field will be the requestBody
YAML param.
It probably looks something like this:
---
- webhook:
description: SendGrid Send
url: https://api.sendgrid.com/v3/mail/send
method: POST
requestBody: |
{
"personalizations":[
{
"to":[
{
"email":"john.doe@example.com",
"name":"John Doe"
}
],
"subject":"Hello, World!"
}
],
"content":[
{
"type":"text/plain",
"value":"Heya!"
}
],
"from":{
"email":"sam.smith@example.com",
"name":"Sam Smith"
},
"reply_to":{
"email":"sam.smith@example.com",
"name":"Sam Smith"
}
}
token: Bearer <<YOUR_API_KEY>>
triggers:
status: failed
Note the indentation is off in the example above, you may need to space it as per the YAML specification to get it parsed into Dozer.
Use failed
for notifications of tasks that could not complete.
Hope that gets you started