Interface RawWebhookEvent

  • All Known Implementing Classes:
    VerifyAndParseResult

    public interface RawWebhookEvent
    Union type representing either a normal typed webhook event or one with a signed URL payload.

    This is the Java equivalent of TypeScript's RawWebhookEvent and Python's RawWebhookEvent. Use isSignedUrlEvent() to narrow the type, then call getEvent() or getSignedUrlEvent() as appropriate.

    Usage

    
     RawWebhookEvent raw = webhooks.verifyAndParseWithOptions(body, headers, secret,
         VerifyAndParseOptions.builder().allowSignedUrl(true).build());
    
     if (raw.isSignedUrlEvent()) {
         WebhookEventWithSignedUrl signedEvent = raw.getSignedUrlEvent();
         WebhookEvent full = webhooks.fetchSignedPayload(signedEvent);
     } else {
         WebhookEvent event = raw.getEvent();
         event.visit(...);
     }
     
    • Method Detail

      • isSignedUrlEvent

        boolean isSignedUrlEvent()
        Returns true if this is a signed URL event (payload delivered via URL).
      • getEvent

        WebhookEvent getEvent()
        Returns the typed webhook event when this is a normal (inline) event.
        Throws:
        java.lang.IllegalStateException - if this is a signed URL event
      • getSignedUrlEvent

        WebhookEventWithSignedUrl getSignedUrlEvent()
        Returns the signed URL event when the payload was delivered via URL.
        Throws:
        java.lang.IllegalStateException - if this is not a signed URL event
      • getEventId

        java.lang.String getEventId()
        Returns the event ID (works for both normal and signed URL events).
      • getEventType

        java.lang.String getEventType()
        Returns the event type string (e.g. "workflow_run.completed").