Use JSON Generator to create a JSON Data Structure and make an HTTP request using an API Key (SendGrid example)

Summary:

Use the JSON Generator in the 'Create JSON' module to automatically add a data structure using a sample JSON. Learn how to modify it and make an HTTP request using an API key to connect to a third-party service. In this tutorial, we have used SendGrid and have shown how to do the following:

  1. Connect to SendGrid over HTTP

  2. Send an email using SendGrid directly from the HTTP module on Make

  3. Send an email using a template on SendGrid

Relevant points to note

  • SendGrid's authentication takes place using an API Key. Hence we use the 'Make a request' HTTP module on Make.

    Use-JSON-Generator-to-create-a-JSON-Data-Structure-1.png
    Use-JSON-Generator-to-create-a-JSON-Data-Structure-2.png
  • To send an email directly from the HTTP module, add the 'content' parameter to your JSON data structure. As you can see below, 'content' is an array of collections; 'type' and 'value' are where you need to define the content type and the actual content respectively. Also, it is a required parameter and will result in an error if left blank.

    Use-JSON-Generator-to-create-a-JSON-Data-Structure-3.png
  • To send an email using a template, you need to add the 'template_id' parameter. As you can see in the image below, 'template_id' is a simple string and is an optional parameter and hence why it can be left blank.

    Use-JSON-Generator-to-create-a-JSON-Data-Structure-4.png

Video tutorial

Note: if the video is not working for you, open it directly in YouTube.

Here's the link to the template used in this scenario and you can refer to the SendGrid API Docs here.

Please note that Make only supports V3 of the SendGrid API.