Skip to content
Tutorials Center
My learning

Topics

Lesson 21 of 36 ยท Webhooks and APIs

Sending Requests with Webhook Actions

Use Webhooks by Zapier as an action to call any API: choose POST, GET, PUT or Custom Request, set headers and a JSON body, and read the response in later steps.

In the previous lessons a webhook was the start of a Zap. This lesson turns the idea around: your Zap makes the call. Whenever an app has a public HTTP API but no Zapier integration (or the integration lacks the endpoint you need), the Webhooks by Zapier action events let you talk to it directly. This is the most powerful escape hatch in Zapier, and it is also where beginners meet HTTP for the first time, so we start with the vocabulary.

Because the real product is not available here, the code in this lesson is stand-in JavaScript that builds and checks requests the way the action forms do. No network calls happen in the examples.

HTTP in one table

An HTTP request has a method, a URL, headers and an optional body. The server answers with a status code, headers and a body.

Method Meaning Typical Zapier event
GET Read something GET
POST Create something or run an operation POST
PUT Replace or update something PUT
PATCH, DELETE, others Partial update, delete Custom Request

The action events in Webhooks by Zapier are named GET, POST, PUT and Custom Request. Custom Request lets you choose any method and write the raw body yourself, so it covers PATCH and DELETE too. Pick it when the API documentation shows something the simpler events cannot express.

Filling in the POST form

When you choose the POST event the form shows these fields (labels may change slightly between releases):

  • URL: the full endpoint, for example https://api.example.com/v1/contacts.
  • Payload Type: Form, Json or Xml. Choose Json for most modern APIs; Zapier then sets the content type for you.
  • Data: a list of key/value pairs. For Json, Zapier builds the object from them. Map earlier fields into the values.
  • Wrap Request In Array: wraps the object in a list, for APIs that expect [ { ... } ].
  • File: an optional file to upload.
  • Unflatten: when yes, a key like customer__email is turned back into a nested object { "customer": { "email": ... } }. This is the opposite of what the trigger does.
  • Basic Auth: username|password for APIs that use HTTP Basic.
  • Headers: extra header lines, one per line, like Accept: application/json.

Many APIs also expect an Authorization header. A typical line is Authorization: Bearer <your token>. Never paste a secret into a field you share with others; see Security and Access Control.

The stand-in below builds the request a POST form would send, including the Unflatten behaviour.

JS Stand-in: build a request from form fields

Press Run (or Ctrl + Enter) to see the console output here.

No output.

If the API needs nested JSON and you forget Unflatten, the API sees a literal key customer__email and usually answers with an error about missing fields. If the API needs flat form fields and you turn it on, you get the reverse problem.

Reading the response

After the call, the step's output contains the response. Zapier gives you fields such as the status code, the response headers, the raw body and, when the body is JSON, its fields (flattened with the same __ rule as before). Later steps can use them, for example to take the new contact's id from the answer and store it in a Table.

Always check the status code before you trust the result. The families are:

Range Meaning What to do
2xx Success Continue
3xx Redirect Use the final URL
4xx Your request is wrong (400, 401, 403, 404, 422, 429) Fix data or auth; 429 means slow down
5xx Server trouble Retry later

Zapier treats most 4xx and 5xx statuses as a step error, which stops the Zap run and appears in Zap history (more in Error Handling and Replays).

JS Stand-in: decide what to do with a response

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Using GET and query parameters

A GET request has no body; extra data goes into the URL as query parameters. In the form, add them under Query String Params (name and value pairs) rather than gluing them to the URL yourself; Zapier encodes special characters correctly. For example a search endpoint with q and limit becomes ?q=ada%20lovelace&limit=5. Typical uses: look up a customer by email before creating a duplicate, fetch the current exchange rate, check whether a username is free.

The pattern "GET first, then branch" is the building block of every robust automation: look it up, then create or update depending on the answer, with the branching tools from Filters, Paths and Formatting.

When to use a built-in app instead

Prefer a built-in app action when one exists: authentication is handled for you (OAuth, refresh tokens), the fields are labelled, and Zapier can keep the integration working when the API changes. Choose the Webhooks action when the app has no integration, when you need an endpoint the integration does not expose, or when you want to call your own service.

Every request is a task in your plan when the step succeeds. A Zap that calls three APIs per run costs three tasks per run, so batch or skip calls you do not need. See Task Usage and Cost Control.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which Webhooks by Zapier event lets you send a DELETE request?

    Custom Request lets you choose any HTTP method and write the body yourself.
  2. 2. The API expects {"customer": {"email": "..."}} and you map a field called customer__email. What setting helps?

    Unflatten turns double-underscore keys back into nested JSON objects.
  3. 3. An API answers 429. What does it usually mean?

    429 means too many requests; wait and retry more slowly.
  4. 4. Why prefer a built-in app action over a raw webhook call when one exists?

    Built-in integrations manage auth and keep fields labelled. Raw webhooks give you control at the cost of doing it yourself.

Summary

  • Webhooks by Zapier action events: GET, POST, PUT and Custom Request (any method).
  • Choose a payload type, map data, add headers, and use Unflatten for nested JSON.
  • Read the status code first; 2xx is success, 4xx means fix your request, 5xx means retry.
  • Look things up with GET before creating records, to avoid duplicates.
  • Each successful action step counts as a task.

Next: API Authentication, Pagination and Rate Limits