Course/Chapter 6/4. Testing Webhooks & External APIs
    intermediate
    Chapter 6: Pinning & Testing Strategies

    4. Testing Webhooks & External APIs

    Mock external services for reliable testing.

    14m Lesson 4 of 4

    Testing workflows that depend on external services requires techniques to simulate incoming data and mock API responses.

    Tools & Techniques

    • - webhook.site: Free service to inspect webhook payloads
    • - Postman/curl: Send test payloads to your webhook URL
    • - Request Bin: Capture and inspect outgoing requests
    • - Pin data: Mock API responses by pinning example output

    Code Examples

    Test a Webhook with curl
    bash
    # Send a test payload to your n8n webhook
    curl -X POST https://your-n8n.com/webhook-test/your-id \
      -H "Content-Type: application/json" \
      -d '{
        "event": "order.created",
        "order_id": "TEST-001",
        "customer": {
          "name": "Test User",
          "email": "test@example.com"
        },
        "items": [
          {"product": "Widget A", "qty": 2, "price": 29.99}
        ]
      }'

    Pro Tips

    • 💡Use the -test suffix webhook URL during development — it doesn't require the workflow to be active

    Comprehension Quiz

    Answer 2 of 2 correctly to unlock lesson completion.

    1. What tool can you use to send test payloads to a webhook?

    2. What is the -test suffix URL for?

    Pass the quiz above to unlock lesson completion