https://github.com/gtmoose32/sendgrid-azure-eventgrid
A library for .NET that converts Twilio SendGrid web hook events into EventGrid events and publishes them.
https://github.com/gtmoose32/sendgrid-azure-eventgrid
azure azure-event-grid azure-functions eventgrid sendgrid sendgrid-inbound-webhook-parser twilio twilio-sendgrid
Last synced: about 2 months ago
JSON representation
A library for .NET that converts Twilio SendGrid web hook events into EventGrid events and publishes them.
- Host: GitHub
- URL: https://github.com/gtmoose32/sendgrid-azure-eventgrid
- Owner: gtmoose32
- License: mit
- Created: 2019-12-14T03:27:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-21T11:56:07.000Z (about 3 years ago)
- Last Synced: 2026-02-26T03:17:01.838Z (4 months ago)
- Topics: azure, azure-event-grid, azure-functions, eventgrid, sendgrid, sendgrid-inbound-webhook-parser, twilio, twilio-sendgrid
- Language: C#
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Moosesoft.SendGrid.Azure.EventGrid
[](https://dev.azure.com/gtmoose/Mathis%20Home/_build/latest?definitionId=9)
[](https://www.nuget.org/packages/Moosesoft.SendGrid.Azure.EventGrid/)

## What is it?
A library for .NET that converts [Twilio SendGrid delivery and engagment events](https://sendgrid.com/docs/for-developers/tracking-events/event/) into [Azure Event Grid](https://azure.microsoft.com/en-us/services/event-grid/) events and publishes them to a topic.
## Installing Moosesoft.SendGrid.Azure.EventGrid
```
dotnet add package Moosesoft.SendGrid.Azure.EventGrid
```
## Azure Function Sample
Working version of the sample code below is found [here](https://github.com/gtmoose32/sendgrid-azure-eventgrid/tree/master/samples). Note: The Azure Event Grid topic configuration settings in the sample are fakes.
```C#
public class SendGridEventHandler
{
private readonly IEventGridEventPublisher _eventGridEventPublisher;
public SendGridEventHandler(IEventGridEventPublisher eventGridEventPublisher)
{
_eventGridEventPublisher = eventGridEventPublisher ?? throw new ArgumentNullException(nameof(eventGridEventPublisher));
}
[FunctionName(nameof(HandleSendGridEventsAsync))]
public async Task HandleSendGridEventsAsync(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest request,
CancellationToken cancellationToken)
{
await _eventGridEventPublisher.PublishEventsAsync(request.Body, cancellationToken).ConfigureAwait(false);
return new OkResult();
}
}
```