SendGrid Channel Provider
Configuration
The configuration steps are explained in the sendgrid configuration page.
Usage
1. When configured with
{
"api_key": "SG.1234567890",
"from": {
"email": "matt@magicbell.com",
"name": "Matt"
},
"reply_to": {
"email": "hana@magicbell.com",
"name": "Hana"
}
}
2. With a channel token
{
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"api_key": {
"description": "The API key for Sendgrid",
"type": "string"
},
"from": {
"properties": {
"email": {
"description": "The email address to send from",
"format": "email",
"type": "string"
},
"name": {
"description": "The name to send from",
"type": [
"string",
"null"
]
}
},
"required": [
"email"
],
"type": "object"
},
"reply_to": {
"properties": {
"email": {
"description": "The email address to reply to",
"format": "email",
"type": "string"
},
"name": {
"description": "The name to reply to",
"type": [
"string",
"null"
]
}
},
"required": [
"email"
],
"type": "object"
}
},
"required": [
"api_key"
],
"type": "object"
}
3. With Broadcast
{
"action_url": "https://example.com",
"category": "example",
"content": "Hello, World!",
"custom_attributes": {},
"id": "d1b3b3b3-3b3b-3b3b-3b3b-3b3b3b3b3b3b",
"overrides": {},
"recipients": [
{
"custom_attributes": {
"plan": "enterprise",
"preferred_pronoun": "They",
"pricing_version": "v10"
},
"email": "test@example.com",
"external_id": "83d987a-83fd034",
"first_name": "Person",
"last_name": "Doe",
"phone_numbers": [
"+1 5005550001"
]
}
],
"title": "Hello, World!",
"topic": "example"
}
The channel handler triggers a HTTP request
POST https://api.sendgrid.com/v3/mail/send
With payload
{
"content": [
{
"type": "text/html",
"value": "Hello, World!"
}
],
"from": {
"email": "matt@magicbell.com",
"name": "Matt"
},
"personalizations": [
{
"to": [
{
"email": "dan@example.com",
"name": null
}
]
}
],
"reply_to": {
"email": "hana@magicbell.com",
"name": "Hana"
},
"subject": "Hello, World!"
}