Contentful->IFTTT-Twitter

Automate Social Media, Contentful can Promote in Tweets

An amazing way to tweet automatically when you post a blog Entry in Contentful using If This Then That (IFTTT)

Michael Eakins · 3 minute read

Recently, I came across an interesting blog by Shy Ruparel titled "How to post to Twitter using Contentful webhooks and IFTTT". Shy did a great job of walking us through the process, from introducing us to the magical In This Then That (IFTTT) website, to demonstrating how to create the Webhook in IFTTT and then subsequently how to wire this up in a Contentful Webhook.

My implementation was slightly different and my tweets kept posting without any of the payload data similar to: Blackhole Software just posted an interesting article: . Check it out at .

I spent some time trying to work through this issue and eventually I turned to the Google Machine. I was very fortunate that in my results one of the first results was from Luce Carter. She had struggled with a similar problem and using one of the steps she provided helped me solve my issue. Thank you Luce Carter! Her blog titled, "Troubleshooting Webhooks in Contentful" held the solution for me.

Luce explains that she, like myself, had been following Shy's blog and when she went to test out her Contentful Webhook, it was sending blank information to IFTTT. You can see this by going to IFTTT, selecting your account icon on the left side and in the dropdown selecting My Services.

Once you select this you will be taken to a screen where you can see My services. Scroll all the way to the bottom and there is a Webhooks section. Select Webhooks and on the next screen select My Applets.

Select your Applet. On the next screen scroll down to the View activity section and select the View activity button.

In this section you can see the latest activity for your Webhook. Select the Webhooks: Receive a web request section to be transported to the latest request including payload.

In this area prior to finding Luce Carter's post, I was seeing:

Value2

Value1

This blank payload data was unexpected as I had configured Contentful to send the same payload as Shy had suggested.

{
  "value1": "{/payload/fields/title/en}",
  "value2": "{/payload/fields/slug/en}"
}

Luce Carter pointed out some troubleshooting shooting steps she use. The first being a fabulous find. She suggested using a wonderful website, https://webhook.site/.

webhooke.site provides you with an endpoint that is all yours, you can take this and put it in your Contenful Webhook in the URL section. Unpublished and republish a post to see the data being passed. Doing this allowed me to confirm that my payload was empty. This coincided with the results I was seeing on IFTTT.

My next step was to go to my content model and verify my title Field ID and slug Field ID matched what I was using in my payload, they did.

Luce also mentioned in her post that within the Content Model tab on Contentful, there is a JSON

Going to this tab I was able to ascertain that, like Luce, my fields were correct.

Next, I tried the configuring my hook to use the default payload as Luce suggested.

This was the win! Luce noted in her blog that she saw something unexpected when she triggered a publish and so did I. I noted the following values in webhook.site:

"title": { "en-US": "Configuring Contentful to Tweet when new article is posted" }, "slug": { "en-US": "configuring-contentful-to-tweet-when-new-article-is-posted" },

I then went and updated my Contentful Webhook, selecting Customize the web hook payload and passing the values as shown in the image.

My payload is:

{
  "value1": "{/payload/fields/title/en-US}",
  "value2": "{/payload/fields/slug/en-US}"
}
Contenful
Twitter