Still trying to send emails from SQL via Sendgrid

I have tested that I can send an email using the following cURL command:
curl --request POST \
  --url https://api.sendgrid.com/v3/mail/send \
  --header "Authorization: Bearer <somekey>" \
  --header 'Content-Type: application/json' \
  --data '{"personalizations": [{"to": [{"email": "address@email.com.au"}]}],"from": {"email": "address@outlook.com"},"subject": "Sending with SendGrid is Fun","content": [{"type": "text/plain", "value": "and easy to do anywhere, even with cURL"}]}'

and am now trying to translate this into SQL. Can anyone give me some pointers on how to restructure this to use in a SQL http request?
So far I ahave this
SELECT content::json
  FROM http((
          'POST',
           'https://api.sendgrid.com/v3/mail/send',
           ARRAY[http_header('Authorization','Bearer <somekey>'), http_header('Content-Type: application/json')],
           NULL,
           NULL
        )::http_request)
Was this page helpful?