How to make custom API calls with Notion (and other apps) in Make

In your journey through automation in Make (or any other similar software), you may have encountered the need for going beyond the natively available modules because the API endpoint required for your workflow is not natively supported in the trigger/action modules on the platform. This essay explores the “Make an API Call” module in Make, with a particular focus on using the Notion API. The principles explained here apply to any other tool’s “Make an API Call” module.

The “Make an API Call” module in Make is available for any app, and it allows you to directly interact with any API endpoints within that app without the need to handle authentication (which is managed by Make). This feature provides you the freedom to finely tune how data is processed and exchanged in your workflows. Whether a necessary module is missing or you simply crave more control over your data handling, custom API calls can be a valid consideration.

This concept also applies to Zapier and Pipedream, for example. They provide options to make custom API calls either as an available step within the supported apps, or as a fully customizable code-based step (e.g., using Python, JavaScript) — e.g., Code by Zapier, or the Pipedream Run Custom Code step. Arguably, Zapier and Pipedream provide even more customizability and ease of making custom API calls compared to Make, as of April 2024, because their interface for creating and managing custom code is more vast and user-friendly compared to Make.


Understanding Custom API Calls

If you are working with Notion and need to access a specific endpoint not covered by Make's native modules, a custom API call lets you interact with that endpoint directly. This level of interaction ensures you are not limited by the predefined modules within Make, giving you the freedom to execute tasks exactly how you need them.

This could mean deleting a block in Notion, updating a specific record with unique parameters, or integrating with a newly released API service that hasn't been natively integrated into Make yet (using the HTTP module).

You can find the Make “Make an API Call” module within the available module options after selecting your desired app. Almost every app integrated with Make offers this module, allowing you to make an arbitrary, authorized API call.


When to Use Custom API Calls

You'll find the custom API call module in Make useful in two main scenarios. First, when the specific endpoint you need is not natively supported within Make's built-in modules. For instance, if you're using Notion and require access to an endpoint for deleting blocks—a feature not directly available in Make's Notion module—you would turn to a custom API call to accomplish this task.

The second scenario where custom API calls prove invaluable is when you seek greater control over the structure of your API request. For example, while Make’s Notion module might allow you to manipulate data using property names, you might prefer to use property IDs to ensure consistency and reliability in your automation, especially if property names are subject to change.

Using custom API calls allows you to precisely format the request body and specify the data types you want to use, giving you a more robust and error-resistant solution. At the same time, if there is a change in the Notion API, you will be responsible for updating the custom API calls within your Make scenarios, if needed.


Practical Application of Custom API Calls

When applying custom API calls in Make, let’s use the example of deleting a Notion page, which illustrates the practicality of this feature. Suppose you have a page within a Notion database that you wish to remove. Since Make’s Notion modules currently do not offer a direct way to delete a block or page, a custom API call becomes necessary.

To initiate this process, you would access the custom API call module within Make and set up the correct endpoint for deletion, which, according to Notion’s API documentation, is https://api.notion.com/v1/blocks/{block_id}.

In the Make module, you will input only the section starting at /v1, like so: /v1/blocks/{block_id}. You will then replace {block_id} with the correct page ID you intend to delete. Very often, this value is mapped from a previous module within your Make scenario, so that it is dynamic.

gif showing how to find the "make an api call" module in Make

For example, if you are syncing Google Calendar events with a Notion database, you may want to also sync event deletion. As part of this workflow, you will have a dedicated route for deleting pages in the Notion database whenever a Google Calendar event is deleted. This can be a three-step process:

  1. Retrieve updated events in Google Calendar

  2. Include a route with a filter based on the event status = “canceled”

  3. Use a “Search Objects” module to retrieve the event page in Notion

  4. Use the “Make an API Call” as described above to delete the Notion page

NOTE:

Sometimes, when using the “delete block” endpoint in Make as shown above, you will get an error message even if the configuration is correct. When this happens, remove the header “Content-Type” from within the module configuration.

In another scenario, you might want to create a new page in a Notion database. Although there is a native Make module for creating a page, using a custom API call gives you more control over the request parameters and structure.

For this task, you would set up the custom API call to use the POST method, targeting Notion’s endpoint for page creation (/v1/pages). The body of your request would include the necessary details for the new page, such as the database ID where the page will be created, and the properties you want to set for this new page.

Screenshot of the JSON request body in the Make an API Call module

Screenshot of the JSON request body in the Make an API Call module

NOTE:

The format of the request body must be JSON. I find it much easier to construct the JSON in a text editor before pasting it into the dedicated Make module. Before pasting the request body into the Make module, ensure that there are no extra spaces or hidden characters, because those will output errors and it may feel hard to wrap your head around them before you find out how “basic” the resolution would be (i.e., remove all extra spaces).

The HTTP module

Sometimes the app you are using is not supported natively in Make. In this case, you can use the HTTP “Make a request” module. This is a more advanced use case and it requires that you understand and follow the documentation of the app you are using, from the authentication flow through formatting the API request properly according to the rules set in the documentation. All the details of using this module are outside of the scope of this essay. For a short visualization of what this module looks like, watch the last part of the video, and read the official Make documentation.


For questions or thoughts about this post, contact me here.

 
 



Similar Articles


Previous
Previous

How to build a client portal in Notion with the new Notion Home

Next
Next

Essential principles of effective asynchronous work