Forum Discussion
WordPress API to Catalogs
Hi all,
I'm trying to automate the process of getting our blog posts (on wordpress) updated to a catalog. Ideally, this would automatically create a new catalog item when a new blog was created and would update images and information when an existing blog post is updated.
Does anyone have experience doing this and how was it accomplished? Is it working for you?
Thanks!
4 Replies
- TedScottVisionary
Absent writing your own custom wp plugin (might not be all that hard with the help of AI at this point), you can probably use zappier and the braze catalog endpoint
https://www.braze.com/docs/api/endpoints/catalogs
https://www.braze.com/docs/api/endpoints/catalogs/catalog_items/synchronous/post_create_catalog_item/#example-request
Not sure how long your articles are, but there is a 5000 character limit in catalogs. - emily_wriSupporter
Thank you!
- phil_lSupporter
You could also do this purely in Braze using connected content and webhooks. e.g.
PUT https://rest.iad-XX.braze.com/catalogs/events/items
In your webhook body, get today's posts from Wordpress
{% assign today_start = now | date: "%Y-%m-%dT00:00:00" %} {% assign today_end = now | date: "%Y-%m-%dT23:59:59" %} {% connected_content https://your-site.com/wp-json/wp/v2/posts?status=publish&after={{ today_start | url_encode }}&before={{ today_end | url_encode }}&per_page=20&orderby=date&order=desc&_fields=id,title,link,date :method get :retry 1 :save posts %}And then loop through the items if there are any e.g.
{% if posts and posts.size > 0 %} { "items": [ {% for p in posts %} { "id": "{{p.id}}", "title": "{{p.title}}", "link": "{{p.link}}", }{% if forloop.last %}{% else %},{% endif %} {% endfor %} ] } {% endif %}Depending on how often you're updating the blog, schedule it to run a few times a day
- Anna180Collaborator
Hi Emily,
Automating updates from WordPress to a catalog can definitely save a lot of time. One approach is to use automation tools that handle data syncing and updates efficiently. Some users combine these with scripts or APIs to create new catalog items automatically whenever a blog post is published or updated. It might take a bit of setup, but once configured, it can keep your catalog fully up to date without manual work.
Related Content
- 1 year ago
- 1 year ago
- 10 months ago