Scheduled CSV Report - Email Body

Hello I created a watcher that sends a csv to email.

Here's the watcher:

{
  "trigger" : {
    "schedule": {
      "interval": "1h"
    }
  },
  "actions" : {
    "email_admin" : { 
      "email": {
        "to": "<redacted>",
        "subject": "Error Monitoring Report",
        "attachments" : {
          "error_report.csv" : {
            "reporting" : {
              "url": "<redacted>", 
              "retries":40, 
              "interval":"15s", 
              "auth":{ 
                "basic":{
                  "username":"elastic",
                  "password":"changeme"
                }
              }
            }
          }
        }
      }
    }
  }
}

My question is how can I add to the email body?
This is how it looks on the recieving end:

I want to add additional context to the email body

Hi @erikg, You can set body field in action type email.

"actions" : {
  "send_email" : { 
    "email" : { 
      "to" : "username@example.org", 
      "subject" : "Watcher Notification", 
      "body" : "{{ctx.payload.hits.total}} error logs found" 
    }
  }
}

the body field is default to plain text. For HTML, you can use body.html

body:{
    "html":"<b>hi</b>"
}
1 Like