Creating an API Call Notification

Last edit: Jul 02, 2019

This guide will help you create an API Call Notification that pings an API endpoint when a new user signs up.

Requirements

To follow the steps in this tutorial, you should understand the concept of notifications. You'll also use the sign-up form you created in a previous tutorial.

Steps

Creating an API Call Notification is a two-step process:

Step 1: Create API Call Notification

Create an API Call Notification notifications/api_call_notifications/ping_example_com_on_user_sign_up.liquid:


---
name: ping_example_com_on_user_sign_up
to: 'https://example.com/endpoint/{{ form.id }}'
delay: 0
enabled: true
format: http
trigger_condition: true
request_type: POST
headers: '{
  "Content-Type": "application/json"
}'
---
{
  "first_name": "{{ form.first_name }}",
  "id": "{{ form.id }}"
}

This defines a POST request to the endpoint with the newly created user's ID. The response is not stored, it's fire and forget. In this example the body of the request is JSON, and to notify the endpoint about it, you set the Content-Type header to application/json.

Step 2: Connect notification to sign up form

Connect the API Call Notification you created with the sign up form form_configurations/developer/sign_up.liquid:

---
api_call_notifications:
  - ping_example_com_on_user_sign_up
---

Whenever a user successfully sign ups, the https://example.com/endpoint/{{ form.id }} endpoint will be notified.

Important

We do not send real text messages on staging by default. Because any error with sending real text messages on staging might be more costly than sending emails. If you want to test SMS on staging, please change enable_sms_and_api_workflow_alerts_on_staging flag to true in your Partner Portal instance configuration.

Next steps

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

Questions?

We are always happy to help with any questions you may have.