Best answer

Post to ACF fields using Zapier Wordpress API

  • 2 October 2023
  • 15 replies
  • 831 views

Userlevel 1

I am using the Zapier API to wordpress in my Zap and I want to updated customer fields. I have swicted on ACF on the API so they can be seen, and when I send a Get request I can see the fields that I want to post updates to (see below)

I have used the REST API Custom Fields plug-in in wordpress to expose the fields also, which is why you can see them twice (once nested under acf as they were orginally).

However when I use the Query String Parameters UI to update these they don’t update (the other fields do update as expected(. I saw some older posts that you can’t update Custom Fields from Zapier to Wordpress, but is that the case even when I can see the fields exposed in the API using the GET request?

I am not a coder, so trying my best to figure out how to get this to work. Thank you.

icon

Best answer by Troy Tessalone 4 October 2023, 18:10

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

15 replies

Userlevel 7
Badge +14

Hi @Connie-C 

Good question.

 

Can you post full screenshots with how your Zap step is configured?

Can you post the link to the WordPress API endpoint documentation you are referencing?

 

These are properties of the “acf” object, meaning those are nested, so the structure of the request needs to be set correctly.

There may be other issues with how the Zap step is configured, which is TBD based on feedback to the questions above.

 

 

Userlevel 1

Hi Troy,

The Zap Step configuration is below. Title, content, featured_media and categories are working as expected (as they are standard parameters for Posts on wordpress).

The wordpress API for Posts that I’m using is here: https://developer.wordpress.org/rest-api/reference/posts/

And the ACF API documentation is here: https://www.advancedcustomfields.com/resources/wp-rest-api-integration/

 

The ASF set-up in wordpress is below showing the 3 parameters I want to post to, and that I have tehm set to Show in the API

 

Thanks again

Userlevel 7
Badge +14

@Connie-C 

Try adding this before each of the acf fields:

acf_

 

Userlevel 1

Hi @Troy Tessalone - no luck unfortunately. 

 

The look this in the query string request

 

But these are blank in the the response 

 

Userlevel 7
Badge +14

@Connie-C 

You may want to try using a CUSTOM POST request so you can set RAW JSON in the Data field.

 

Userlevel 1

@Troy Tessalone I can get the webhooks zap to connect to wordpress and post the same data that is already working, but I’m struggling with the set-up of a Custom Post and where to put the JSON (like I said, not a coder 😅). This is the set-up I have at the moment which is giving me an error - any help would be appreciated!

 

Userlevel 7
Badge +14

@Connie-C 

Remove the leading data:

 

Userlevel 1

Still getting the same error :/

The headers are blank in case that has any impact:

 

Userlevel 1

@Troy Tessalone I figured out how to send the correct JSON format as per below:

But now I get this error - I’m wondering if it’s just not possible to POST to the ACF fields from Zapier for some reason even though I can see them in the response 😓

 

Userlevel 1

@Troy Tessalone Never mind I got it working using the JSON below - thank you so much for your help!!!

{
    "acf": {
        "where": "Online",
        "when": "April, 2023",
        "link_to_event": "https:\\/\\/www.example.com"
    },
    "link_to_event": "https:\\/\\/www.example.com",
    "when": "April, 2023",
    "where": "Online"
}

Userlevel 1

Hi ! I’m experiencing quite the same issue, except I couldn’t resolve it even with the help of this post.

If anyone can help, it would be much appreciated !

Here’s my setup for a custom request :

 

 

And when I preview I got this : 

 

And once I test, it’s empty, nothing’s inserted.

Like my friend above, I’m not a dev (at all).

Also, please note :

  • I’ve tried all possible JSON I could imagine and find in docs, forums etc.
  • I’ve tried using custom requests and POST
  • I’ve tried using FORM + key and value
  • I’ve tried using ACF to REST API plugin and without it (with another endpoint /wp-json/acf/v3/posts/ if activated)
  • I’m using JWT Authentication for WP-API for the token

But still nothing’s inserted in my custom fields.

Please, do you have any ideas ?

MANY THANKS :)

Chris

 

 

 

Userlevel 1

Hi Chris,

 

Not sure if it will help but I eventually found the correct JSON format when I found the ACF for the event posts by going to companyurl.com/wp-json/wp/v2/events in my browser and there I could see how the ACF fields appear as a JSON file and that’s where I realised the fields were populated twice (for some reason). It only worked for me when I input the JSON twice to match this exactly (as per my last post above). So checking the format there for your posts may help!

 

Userlevel 1

Hello guys,

After several tests, I found the problem. The default Content-type header sent was “application/json; charset=UTF-8”. I forced the header to be “application/json” only, and it worked !!!

Hope this helps !!!

Chris

Userlevel 1

Hi Chris,

 

Not sure if it will help but I eventually found the correct JSON format when I found the ACF for the event posts by going to companyurl.com/wp-json/wp/v2/events in my browser and there I could see how the ACF fields appear as a JSON file and that’s where I realised the fields were populated twice (for some reason). It only worked for me when I input the JSON twice to match this exactly (as per my last post above). So checking the format there for your posts may help!

 

Hey Connie,

Thanks for the tip ! It will help as well !

Have a nice day,

Chris

 

I’m hoping someone has some advice for me. I’m trying to update an ACF field in WordPress. My Zap will authenticate to my site however I am getting a 500 error. I’m at a loss. I’m using a Custom Request Post. Is anyone able to tell me what I am missing?