Home > OS >  Connect SendGrid Event Webhooks to Azure Application Insights
Connect SendGrid Event Webhooks to Azure Application Insights

Time:02-11

In setting up SendGrid, I was advised to use SendGrid Event Webhooks. Since I'm working in Azure, Application Insights seemed like the most sensible end-point for event logging. It gives me integrated logs across my app and provides extensibility if I need to do more (like alerting) in the future.

I've found no instances online that this can be done directly. I assume I could consume the events in a custom app and feed it into Application Insights that way, but it feels like that step shouldn't be required for a basic level of functionality.

I'm very new to this environment (Azure/cloud), so I expect I'm missing either a technical or rational reason why this wouldn't or shouldn't work.

Can you connect Twilo SendGrid Event Webhooks to Azure Application Insights directly? If so, how? If not, why not (either technically or for more philosophical reasons)?

CodePudding user response:

Twilio SendGrid developer evangelist here.

I'm not aware of a way to connect SendGrid directly to Azure Application Insights.

I have not used Application Insights myself. I've had a quick look around the docs and it seems that when sending metrics or other things you want to track to Application Insights there are libraries you use to make those requests in the format that Application Insights requires as well as with a key that presumably identifies and authorizes your account to do so.

SendGrid event webhooks do not follow the same format that Application Insights would expect (and why would they? They are different services from different companies), nor do they allow for you to include the key in the request. SendGrid event webhooks were built for anyone to be able to consume them, not for a particular third party service to do so, so I can't see why there would necessarily be a direct integration to Application Insights. As far as I can tell, SendGrid event webhooks also pre-date Application Insights by a few years.

I think your idea to consume the events in a custom app and translate the data into a format that Application Insights can ingest is the right idea.

  • Related