Webhooks
In this guide, we will look at how to register and consume webhooks to integrate your app with GLAPI. With webhooks, your app can know when something happens in Protocol, such as someone sending a message or adding a contact.
Registering webhooks
To register a new webhook, you need to have a URL in your app that Protocol can call. You can configure a new webhook from the Protocol dashboard under API settings. Give your webhook a name, pick the events you want to listen for, and add your URL.
Now, whenever something of interest happens in your app, a webhook is fired off by Protocol.
How GLAPI Processes Webhooks
When GLAPI receives a webhook from an external system (like Procore or NetSuite), it goes through several steps:
- Verification: GLAPI first verifies the webhook's signature (as described in the Security section) to ensure it's legitimate.
- Storage: The valid webhook event is stored in our system for tracking and potential retries.
- Queuing: The event is placed in a queue for processing.
- Processing: A background process picks up the event and performs the necessary actions based on your project's specific configuration.
This processing step is where your project settings come into play.
Project-Specific Configuration
System Defaults: Your system administrator can configure default webhook settings (like default cutoff dates and auto-sync options) that apply system-wide. When a new project is created, it automatically inherits these defaults. You can then customize these settings for your specific project as described below. Project-specific settings always override the system defaults.
You can customize how GLAPI handles incoming webhooks on a per-project basis. These settings allow you to control which events trigger actions within GLAPI and under what conditions.
Key configuration options include:
-
Financial Cutoff Date:
- Purpose: This setting (currently applicable to Procore Requisitions) prevents GLAPI from processing or syncing financial transactions that occurred before a specific date. This is useful for ensuring that historical data that has already been reconciled or migrated is not inadvertently modified.
- How it works: When a requisition webhook is received, GLAPI checks the requisition's date against this cutoff date. If the requisition date is earlier than the cutoff date, GLAPI may skip syncing it, depending on your specific workflow rules.
- Further details: For more detailed logic on how the cutoff date applies, see Procore Cutoff Logic.
-
Automatic Syncing (Auto-Sync):
- Purpose: For various types of events (e.g., Requisitions, Purchase Orders, Vendor Bills), you can decide whether GLAPI should automatically attempt to sync the corresponding data when a webhook is received.
- How it works: Each relevant event type (like
procore.requisition.created
,netsuite.vendorbill.updated
, etc.) has an associated toggle in your project settings.- If enabled, GLAPI will automatically try to process and sync the data related to the webhook event.
- If disabled, GLAPI will still record the webhook event but will not automatically initiate the sync process. This allows you to review events manually or trigger syncs through other means if needed.
- Configurable Events: You can typically configure auto-sync for events related to:
- Procore Requisitions
- Procore Purchase Orders
- Procore Commitments
- NetSuite Vendor Bills
- NetSuite Purchase Orders
- (Check your specific project settings for the full list)
These settings provide fine-grained control over how GLAPI interacts with your integrated systems based on webhook events. You can manage these configurations within your project settings page in the GLAPI application.
Procore Event Types
GLAPI can listen for various events from Procore. Here are some common event types you might configure:
- Name
procore.purchase_order.created
- Description
A new Purchase Order was created in Procore.
- Name
procore.purchase_order.updated
- Description
An existing Purchase Order was updated (e.g., amount, status change).
- Name
procore.purchase_order.deleted
- Description
A Purchase Order was deleted in Procore.
- Name
procore.commitment.created
- Description
A new Commitment (Contract) was created in Procore.
- Name
procore.commitment.updated
- Description
An existing Commitment (Contract) was updated in Procore.
- Name
procore.commitment_change_order.created
- Description
A new Change Order related to a Commitment was created.
- Name
procore.commitment_payment_application.created
- Description
A new Payment Application related to a Commitment was submitted.
- Name
procore.project.updated
- Description
Project details (e.g., status, budget) were updated in Procore.
Note: The exact event type names (procore.resource.action
) may vary slightly. Refer to the Procore API documentation and your GLAPI project configuration for the specific event types available.