Skip to content

Native Data Connector that connects to the SendGrid REST API

License

Notifications You must be signed in to change notification settings

hasura/ndc-sendgrid

Repository files navigation

SendGrid Connector

The SendGrid Native Data Connector allows for connecting to the SendGrid v3 API and exposing its functionality from your Hasura API. While this is a functional implementation of the SendGrid API, it also serves as a minimal example of an "Action" style connector using the Rust Data Connector SDK.

In order to use this connector you will need to:

Features

This connector is a minimal implementation of the SendGrid v3 API functions:

  • Sending mail (the send_mail procedure)
  • Getting a list of email templates (the list_templates function)

It also serves as an example of how an Action style connector can be implemented in Hasura V3.

For Hasura Users

Add the SendGrid connector to your DDN project by running

> ddn connector init -i

Select the SendGrid connector from the list and provide a name for the connector and your SendGrid API key.

Then you need to introspect the connector to get its schema:

> ddn connector introspect <connector name>

And then you can add all the SendGrid commands to your supergraph:

> ddn command add <connector name> "*"

You can now build your supergraph, run it locally, and open the Hasura Console to try it out:

> ddn supergraph build local
> ddn run docker-start
> ddn console --local

For Developers

The following instructions are for developers who wish to contribute to the SendGrid Connector.

Build

Prerequisites:

  1. Install rustup.

Commands:

cargo build
SENDGRID_API_KEY="YOUR-API-KEY-HERE" cargo run -- serve --configuration .

Docker

docker build . --tag ndc-sendgrid
docker run --rm -it -e SENDGRID_API_KEY="YOUR-API-KEY-HERE" -p 8080:8080 ndc-sendgrid