Morpheus with Webhooks?

Hi all. I put together an app that watches Morpheus processes and can be configured to make webhooks, sending info about the process/event to external applications that support them.

It’s got good test coverage but has limited real-world testing. Would love some feedback from the Morpheus community… is it useful, is it worth extending the webhook triggers (only a limited set are available ATM). Hope all good!

2 Likes

Oh cool! I’ll check this out once I’m back from vacation!

1 Like

Hey guys. I wanted to follow up now I’ve eventually worked out “YouTubing” :wink:

Here is a demo of the Dozer app, interfacing with a Slack Bot.

Hope all good!

How this can be used to send email instead of slack message from any of the task failure notification!

SMTP isn’t a supported. But the webhook is only a HTTP request with a request body, so you could use an email service provider which allows you to send emails by making REST API requests.

SendGrid and Mailgun are two such providers that spring to mind.

1 Like

Thank you,

it would be great incase if you have some sample code for this!

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 :+1: