tr Skip to content
Black Friday FlowMattic for life, 12 payments of $33.25 Or $399 once. Nothing added for splitting Ends in --Days --Hrs --Min --Sec See the deal

When webhook data is received, trim the white space and create a new post in WordPress

Send data to a FlowMattic webhook URL, clean a field with Text Formatter’s Trim White Space option, and create a WordPress post from the result on the same site.

Webhook Text Formatter by FlowMattic WordPress

3 steps Setup ~5 min Used on 1.7k sites Free to import

The When webhook data is received, trim the white space and create a new post in WordPress workflow on the FlowMattic canvas, with 3 steps across Webhook, Text Formatter by FlowMattic, WordPress
The workflow as it appears in the builder after import. Each step opens for editing.

What this workflow does

Text that arrives from another system often carries stray spaces, tabs and line breaks around the parts you want. Put that straight into a post title and you get odd gaps or a broken slug. This workflow tidies one field before WordPress uses it.

The Webhook trigger hands you an endpoint for this post feed. Any app or script that sends data to it starts a run, and every value in the request becomes available to map. Next, Text Formatter by FlowMattic runs Basic Formatting. The template doesn't set the method or the text yet, so choose Trim White Space and map the field you want cleaned. That option removes spaces at both ends and turns every run of spaces, tabs or line breaks into a single space.

Last, the WordPress step creates a new post on the site where FlowMattic runs. Map the cleaned value into the title, map the other webhook values where they belong, and set the post status you want. Each request to the URL creates one post.

Titles from a spreadsheet script

A Google Apps Script posts rows to the webhook, and the trimmed title column becomes the post title, without the trailing spaces copied in from the sheet.

Announcements from an internal tool

Your team's internal dashboard sends a short headline and body to the URL, and each one becomes a draft post for an editor to check.

Importing listings from a partner feed

A partner system pushes listing names that carry padding and line breaks. Trimming the name first gives clean post titles and slugs.

How this workflow runs

What happens at each step once the workflow is on, and what you need before you import it.

  1. Step 1Trigger
    Webhook Capture Webhook Response

    Provides the endpoint your sending app or script calls with the post data. Each request sent to it starts a run, and the values in the request are available to map in the next two steps.

  2. Step 2Action
    Text Formatter by FlowMattic Basic Formatting

    Runs Basic Formatting on one value from the webhook. Choose the Trim White Space method and map the field to clean. It strips spaces at both ends and turns runs of whitespace, including line breaks, into one space.

  3. Step 3Action
    WordPress New Post

    Turns the cleaned data into a new WordPress post. Map the trimmed value into the post title and other webhook values into the content, then set the post type and status the post should get.

What you need

  • FlowMatticCore

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.

  • Trim White Space also turns line breaks into spaces. Use it on titles and short fields, and map the post body straight from the webhook if its paragraphs should stay.
  • Turn on the Webhook trigger's Require authentication on incoming requests setting, so only senders that include your key can create posts.
  • Set the post status to draft while testing, so posts from test requests don't go live before you've checked the mapping.
  • Need a second cleaned field? Add another Text Formatter step before WordPress, one per field, and map each result into the post.

Questions about this workflow

What does Trim White Space do to the text from the webhook?

It removes whitespace at the start and end, and replaces every run of spaces, tabs or line breaks inside the text with a single space. Other characters are left alone.

Can anyone who finds the webhook URL create WordPress posts?

Without authentication, any request that reaches the endpoint can create a post. Turn on Require authentication on incoming requests in the Webhook trigger and send the key with each request.

Does the template clean every field in the request?

No. Basic Formatting works on the one value you map into it. Add more Text Formatter steps if other fields need the same cleanup.

Will a repeated webhook request create a duplicate post?

Yes. The WordPress step creates a new post on each run and doesn't check for an existing one with the same title.

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

Customers who run it every day

Rated 4.8 out of 5 by customers
Read more reviews

It's very straightforward, has a lot integrations and they work well. It is one thing to 'integrate' new external software, but integrating it well, with lots of options is where FlowMattic shines.

Koen A.

Works within WordPress, so it can easily access any inbuilt WP functions or custom functions and use them in your flow. It's easy to use and already has many useful integrations built.