Current as of 1 Jul 2024
Triggers (Zapier)
This document provides technical details about the API routes used for managing triggers in your application. These routes allow for subscribing, unsubscribing, and retrieving trigger data.
Routes
1. Subscribe to Flows
Endpoint: POST /api/zapier/subscribe/flows
Description: Subscribes a user to a flow by creating a listener document in the Firestore database. It verifies the existence and activation status of the Zapier integration task before creating the listener.
Request Headers:
orgid
: The ID of the organization.userid
: The ID of the user.
Request Body:
hookUrl
: The URL to which the flow data will be sent.subscriptionType
: The type of subscription.
Response: Status 201 Created
with a JSON object containing the listener ID. Status 500 Internal Server Error
with an error message if the subscription fails.
2. Unsubscribe from Flows
Endpoint: POST /api/zapier/unsubscribe/flows
Description: Unsubscribes a user from a flow by deleting the listener document in the Firestore database.
Request Headers: orgid
or orgId
: The ID of the organization.
Request Body: hookUrl
: The URL to which the flow data was being sent.
Response: Status 200 OK
with a JSON object containing a success message. Status 500 Internal Server Error
with an error message if the unsubscription fails.
3. Perform List
Endpoint: GET /api/zapier/perform-list
Description: Retrieves a list of triggers for the application. This example creates a static trigger object and returns it in the response.
Response:
Status 201 Created
with a JSON array containing trigger data. Status 500 Internal Server Error
with an error message if the retrieval fails.