Session 4 of 15
Webhooks and APIs โ How Systems Talk
HTTP, REST and JSON without fear: how to receive data from any system with a webhook, return a response, secure it, and talk to any API โ even when it has no ready app in Make.
โฑ๏ธ 3 hours๐ ๏ธ A lead-intake API: a secure webhook โ validation โ enrichment โ a JSON response
๐ฏ Session goals
- Explain what an API, REST, HTTP methods, headers, a body and status codes are.
- Create a custom webhook, define a data structure and receive requests.
- Return a tailored response with Webhook response (status, JSON, headers).
- Secure a webhook with an API key in a header and a filter.
- Use the HTTP module with different authentication methods, a query string and a JSON body.
- Build valid JSON with Create JSON and handle special characters.
- Build a lead-intake API that returns a response within a second.
๐งช Today's scenario โ a live run
๐๏ธ The agenda
- 00:00โ00:15 Review: the smart form
- 00:15โ00:45 APIs and HTTP: the way systems talk
- 00:45โ01:15 Custom webhooks and data structures
- 01:15โ01:30 โ Break
- 01:30โ01:50 Webhook response and security
- 01:50โ02:15 The HTTP module: auth, query, body
- 02:15โ02:50 Building together: a lead-intake API
- 02:50โ03:00 Summary and practice
What is an API?
- API = a system's service counter
- Method, URL, query, headers, body
- JSON
- Status codes: 2xx, 4xx, 429, 5xx
Webhook โ when the system calls you
- Pull vs. push
- Custom webhook = a unique address
- Redetermine / data structure
- Get request headers
- The request queue
Webhook response โ returning an answer
- Without a module: 200 Accepted
- Webhook response: status, body, headers
- Different responses on Router routes
- Return early
Securing a webhook
- An API key in a header + a filter
- IP restrictions
- An HMAC signature
- Secrets in custom variables
The HTTP module in depth
- Auth: API key / Basic / OAuth
- Query, headers, body (raw JSON)
- Evaluate all states as errors
- Create JSON instead of hand-written JSON
Make an API call โ the middle way
- A ready module โ Make an API call โ HTTP
- Make an API call uses an existing connection
- Read the API docs
Building together: a lead-intake API
- Webhook + headers
- Auth Router โ 401
- Validation Router โ 400
- Enrichment โ Create JSON โ 201
โ๏ธ Understanding check
๐ To sum up
- API = a service counter: method, URL, headers, body, status.
- Webhook = the other system calls us โ immediate and without polling.
- Webhook response returns a status and JSON; return early.
- Secure it with an API key in a header and a filter.
- We built a lead-intake API with 401/400/201.
๐๏ธ Time to practice!
The session project: A lead-intake API: a secure webhook โ validation โ enrichment โ a JSON response