Insites Docs Developer Guide NotificationsCreating an API Call Notification

Creating an API Call Notification

Last updated on June 12, 2023.

This document shows you how to create an API Call Notification that pings an API endpoint when a new user signs up.

Prerequisites

To follow the steps in this tutorial, you must understand how notifications work and have created a sign-up form as demonstrated in a previous tutorial.

Steps

Creating an API Call Notification and attatching it to a form is a three-step process:

  • Step 1: Create an API call notification
  • Step 2: Invoke notification directly via GraphQL api_call_send
  • Step 3: Connect the notification to the sign-up form

Step 1: Create an API call notification

app/api_calls/ping_example_com_on_user_sign_up.liquid

This defines a POST request to the endpoint with the newly created user's ID. In this example, the request's body is JSON, and to notify the endpoint about it, you set the header to . If the call is successful, the code from the property is triggered. You can access the endpoint's response via the Response object - which includes headers, status and body. In the example, it is assumed that the server returns valid JSON, which is parsed and logged by the system.

Step 2: Invoke notification directly via GraphQL 'api_call_send'

The API Call notification name is a file path relative to the directory, without extension.

For app/api_calls/ping_example_com_on_user_sign_up.liquid - the bolded part is the name (physical_file_path).

To test your newly created API Call Notification, trigger it using the following query:

All parameters provided via GraphQL as a argument will be accessible in every API Call Notification property as a variable (or to make it compatible with Form).

This is how you can prepare the HashObject for this mutation:

Step 3: Connect the notification to the sign-up form

Connect the API Call Notification you created with the sign-up form :

Whenever a user successfully signs up, the endpoint will be notified.

Next steps

Congratulations! You have created an API Call Notification. Now you can learn about parsing an API response: Parsing an API Response

Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.