Skip to main content
Parchment Health uses webhooks to notify your application in real-time when events happen in your account. This guide will help you integrate with our webhook system to receive and process event notifications.

Overview

  • Delivery: HTTP POST requests to your configured endpoint
  • Retry Logic: Automatic retries with exponential backoff
  • Supported Events: Prescription lifecycle events (created)

How Webhooks Work

  1. An event occurs in Parchment (e.g., a prescription is created)
  2. Parchment sends an HTTPS POST request to your webhook endpoint
  3. Your application processes the event
  4. Your endpoint returns a 2xx status code to confirm receipt

Configuration

Provide Your Webhook Endpoint

Contact Parchment support at [email protected] with:
  • Your webhook endpoint URL (must be HTTPS)
  • Your partner ID

Webhook Endpoint Requirements

Your webhook endpoint must:

1. Use HTTPS

All webhook URLs must use HTTPS with a valid SSL certificate.
 https://api.yourapp.com/webhooks/parchment
 http://api.yourapp.com/webhooks/parchment

2. Return Success Quickly

Respond with a 2xx status code within 10 seconds. Process events asynchronously if needed.
// ✅ Good - acknowledge immediately, process later
app.post('/webhook', async (req, res) => {
  // Acknowledge receipt immediately
  res.status(200).json({ received: true });

  // Process asynchronously
  processWebhookAsync(req.body);
});

3. Handle Retries Idempotently

Parchment may send the same event multiple times. Use the event_id to prevent duplicate processing.
async function processWebhook(event) {
  // Check if we've already processed this event
  if (await eventExists(event.event_id)) {
    console.log('Event already processed:', event.event_id);
    return;
  }

  // Process the event
  await handleEvent(event);

  // Mark as processed
  await saveProcessedEvent(event.event_id);
}

Webhook Delivery

Headers

Every webhook request includes these headers:
HeaderDescriptionExample
Content-TypeAlways application/jsonapplication/json
User-AgentParchment webhook identifierParchment-Webhooks/1.0

Retry Behavior

If your endpoint doesn’t respond with a 2xx status code:
  • Retries: Up to 3 attempts
  • Backoff: Exponential (1s, 2s, 4s)
  • Non-retryable errors: 4xx errors (except 408, 429)
  • Timeout: 10 seconds per attempt

Success Criteria

A webhook is considered successfully delivered when your endpoint:
  1. Responds with a 2xx status code (200-299)
  2. Within 10 seconds

Event Types

Parchment sends webhooks for these event types:
Event TypeDescriptionStatus
prescription.createdA new prescription was createdLive
prescription.updatedA prescription was modifiedComing Soon
prescription.cancelledA prescription was cancelledComing Soon
prescription.dispensedA prescription was dispensedComing Soon
prescription.expiredA prescription expiredComing Soon
See Webhook Events for detailed payload examples.