How to Connect WordPress to an External API
Call any API when something happens in WordPress, and let other systems start WordPress workflows with a webhook — without writing a plugin.
2 min read
Not every system you use has a WordPress plugin. A CRM, an internal tool, a status page or a partner’s service usually has an API instead. There are two directions to connect: WordPress calling the other system when something happens on your site, and the other system calling WordPress when something happens there. FlowWP handles both without a custom plugin.
Sending: call an API from WordPress
Add an HTTP Request step after any trigger. It calls a URL with the method, headers and body you set, and passes the response to the steps after it.
- Choose the trigger — an order is paid, a form is submitted, a post is published.
- Add HTTP Request and set the URL and method: GET, POST, PUT, PATCH or DELETE. The URL can include tokens.
- Write the body with tokens from earlier steps. Inside JSON, use the
| jsonfilter so a value is escaped correctly:
{
"email": {{ trigger.order.email | json }},
"total": {{ trigger.order.total | json }}
}
- Add headers, one per line as
Name: value, for example a content type or an authorization header. - Use the response. Later steps can read the status, the body and the body decoded as JSON, such as
{{ nodes.crm.output.json.id }}, and an If / Else can act on the status.
A few things worth knowing:
- Private addresses are blocked. Every URL is checked just before the request, and private, loopback and cloud metadata addresses are refused. A developer can allow a specific internal host with the
flowwp_http_allowed_hostsfilter. - It is not retried automatically. FlowWP cannot know whether the other system treats a repeated request as harmless, so it treats an HTTP request as unsafe to repeat.
- Test runs send GET requests for real; other methods are rehearsed and reported.
HTTP requests are unlimited on every plan, Free included.
Receiving: let another system start a workflow
Add the A webhook is received trigger. It gives the workflow its own URL on your site:
https://your-site.com/wp-json/flowwp/v1/hooks/{key}
The other system sends a request there and gets 202 Accepted straight away; the workflow runs in the background, so a slow workflow never makes the sender time out and retry. The request body is available as {{ trigger.body }}, with JSON fields by path, such as {{ trigger.body.email }}. Set a shared secret and senders must include it in an X-FlowWP-Secret header. Treat the URL itself like a password.
Webhooks are unlimited on every plan. To answer with your own status code and body instead of 202, add Respond to webhook (Business and above).
Two complete examples
- Check a page is up every 15 minutes — a schedule, an HTTP Request and an If / Else on the status code.
- Capture leads from any app with a webhook — a webhook trigger that saves leads with an email in FluentCRM and passes them to your team.
For every setting, see Webhooks and HTTP requests in the docs. Developers who need a reusable step rather than a one-off request can add their own through the FlowWP SDK.
