Set webhook response as OpenAI GPT 4 completion text for the prompt received in webhook
Send a prompt to a FlowMattic webhook URL, have OpenRouter AI generate a completion with a model such as OpenAI’s GPT-4, and get the completion text back as the reply to that same request.
OpenRouter AI
3 steps Setup ~5 min Used on 2.4k sites Free to import

What this workflow does
Calling an AI model from a form, a script or another tool usually means storing API keys in each place. This workflow puts the model behind a webhook URL on your WordPress site. Whatever sends the request gets the generated text back in the response, with the AI account kept inside FlowMattic.
The Webhook trigger receives a request that carries your prompt. The OpenRouter AI step runs Create a Completion on that prompt. OpenRouter gives one account access to many models, including OpenAI GPT-4, so check which model the step uses before you go live. The Webhook Response step then sets the reply to the completion text you map from OpenRouter.
The caller waits for the whole run, so the response arrives once the model finishes writing. Task History keeps each prompt, the completion and the response that was sent. As imported, anyone who has the URL can send prompts unless you turn on authentication in the trigger.
AI replies inside a no-code app
A tool that can call a URL sends a customer question to the webhook and shows the completion it gets back, without holding any AI keys itself.
Product description drafts on demand
Your store's admin script posts a product name and features as a prompt, and the generated description comes back ready to paste.
Testing prompts from a spreadsheet script
A script loops through prompts in a sheet, calls the webhook for each, and writes the returned text into the next column.
How this workflow runs
What happens at each step once the workflow is on, and what you need before you import it.
Webhook Capture Webhook ResponseGives you a webhook URL that starts a run when a request arrives. Send a test request with your prompt in the payload so the OpenRouter step has a field to map.
OpenRouter AI Create a CompletionSends the prompt from the webhook to OpenRouter AI and generates a completion. Connect your OpenRouter account, map the prompt, and check which model the step is set to use.
Webhook Response Set Webhook ResponseReturns data to whatever called the webhook. Map the completion text from the OpenRouter step so the caller receives the model's answer as the response body.
What you need
- FlowMatticCore
- OpenRouter AI AccountAccount
After importing, map your own data. To keep the template universal, not every step is pre-filled. Open each step in the builder and connect your accounts and fields (channels, lists, sheets, recipients) before you switch the workflow on.
Make it yours
Changes worth making after you import it.
- Switch on Require authentication on incoming requests in the Webhook trigger and have your caller send the key, so strangers can't spend your OpenRouter credits.
- Add a fixed instruction in front of the mapped prompt in the OpenRouter step, such as a tone or length rule, so every caller gets answers in the same style.
- Return more than the text by mapping other values from the OpenRouter response into the Webhook Response step, after checking them in a test run.
Questions about this workflow
Is this really GPT-4 if the step is OpenRouter AI?
OpenRouter is a single gateway to many AI models, including OpenAI's GPT-4 family. The step uses whichever model it is set to, so check that setting after import.
Do I need an OpenAI account for the GPT-4 webhook?
No. The template needs an OpenRouter AI account, which you connect in FlowMattic. Usage is billed through OpenRouter.
Can someone else call my AI webhook URL?
Anyone who has the URL can, unless authentication is on. Turn on the trigger's Require authentication on incoming requests setting so each request must carry your key.
How does the caller read the OpenRouter completion?
In the body of the response to its request. Set Webhook Response returns whatever you map into it, so map the completion text from OpenRouter and call the URL from your app once to see the exact shape that comes back.
More AI Automation workflows
Other ready-to-import templates from the same category.







Import this workflow into your WordPress site
Download the JSON, import it from the Workflows screen and connect your accounts. Every run stays on your server, with no per-task fees.
30-day money-back guarantee Unlimited workflows and runs Self-hosted