Internet-Draft | PCRP Webhook Specification | December 2024 |
Arumugham | Expires 26 June 2025 | [Page] |
This document defines the PCRP (Ping, Challenge, Resolve, Product) Specification for Webhook events in a standardized way. It is specifically designed to address the challenges faced in current webhook event implementations, which lack consistency and a defined flow. PCRP introduces a new header X-PCRP-Type to indicate the step of the process, and its values include ping, challenge, resolve, and product.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 26 June 2025.¶
Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
Webhooks are widely used to facilitate communication between systems, but the lack of industry standards for their event flow and error handling poses challenges for developers. Existing webhook implementations often vary significantly between services, leading to potential issues in reliability, debugging, and integration with multiple systems. This draft proposes a new webhook event standard, PCRP, which introduces structured steps for webhooks: Ping, Challenge, Resolve, and Product. This standard ensures predictable behavior and simplifies handling on both the sender and receiver sides.¶
The primary goal of PCRP is to standardize the webhook event lifecycle, reducing ambiguity, improving error handling, and offering a predictable structure for developers to follow. This will help developers address common pain points when integrating webhook events and will lay the foundation for future webhook standards.¶
PCRP introduces a new set of headers for webhook events. The core header is `X-PCRP-Type`, which indicates the step of the process. The four defined types are:¶
The first step in the PCRP process is the "ping" stage. This stage is initiated by the sender to check if the receiver is ready to process the upcoming events. The header X-PCRP-Type: ping indicates that this is a ping message.¶
The body of the ping message may contain additional metadata for the receiver but is generally minimal. The receiver is expected to respond with a 200 OK status if it is ready to proceed to the next stage.¶
The challenge stage is triggered when the receiver needs additional information or validation from the sender. The message will contain the header X-PCRP-Type: challenge, and the body will describe what is required from the sender (such as a CAPTCHA, token validation, or a challenge question).¶
The sender must respond with the appropriate data in the form of a response body. If the challenge is not met or is invalid, an error message should be returned, such as a 400 Bad Request.¶
The resolve stage is where the system provides the results or answers that were requested during the challenge stage. This stage includes the X-PCRP-Type: resolve header, and the body will contain the resolved information or status.¶
The receiver is expected to confirm the result or take the next action accordingly. If the response is not acceptable, the system should return a 400 Bad Request or 404 Not Found status as appropriate.¶
The final stage is the "product" event, which is sent to indicate that the event flow has completed successfully. The header X-PCRP-Type: product indicates that the system has completed the requested operation. The body will typically contain the product event data or confirmation that the task has been successfully completed.¶
The receiver may perform any necessary follow-up actions at this stage. The response should generally be 200 OK to confirm that the process has been successfully completed.¶
Each stage in the PCRP specification should provide clear error handling instructions if the flow is disrupted. Depending on the stage, responses might include:¶
Webhooks, including those using PCRP, must be transmitted over secure channels (e.g., HTTPS) to ensure data privacy and integrity. Additionally, authentication mechanisms such as tokens or signatures should be used to verify the sender’s identity and protect against malicious actors.¶
The IANA should maintain a registry for the values of X-PCRP-Type to ensure no collisions with other protocols. The values defined in this document should be registered as part of this registry.¶
Special thanks to my teammate Bharani Shanmugam, who helped shape the PCRP specification, including experts in webhook design and implementation. Additionally, I would like to acknowledge Martin Fowler's work on microservices and transactional integrity, which inspired the design of PCRP's structured communication headers and the focus on maintaining transaction integrity across distributed systems.¶
[RFC791] Internet Protocol, Jon Postel. Date: September 1981.¶