How to Automatically Post Tweets with Suggested Smart Hashtags on Zapier ?

I have been using a formidable technique for a while to post Automatic Tweets with smart hashtags, i.e. hashtags generated based on the textual content of the link shared on Twitter for example.

Zapier
Logo of Zapier

This technique only works on Zapier, indeed, this is a tutorial to learn how to publish your RSS feeds directly on Twitter without going through NodeJS scripts already presented on YubiGeek.com.

It may be interesting to publish the articles of its RSS feeds with hashtags added to the text (title of the article) or at the end of the Tweet.

How to post Tweets with smart hashtags through Zapier?

To use this technique, we need a Zapier account with a paid subscription (the cheapest offer is enough). We also need an API key at Aylien, this time it’s free if you don’t abuse the requests (not too much API call).

If you are already familiar with Zapier, you will have no trouble creating the Zap (an automated process that performs a succession of tasks). If you are a novice, don’t worry, this tutorial will be as precise as possible.

Zapier works by Zap, these are automated processes that execute several tasks synchronously, one after the other (the task is not asynchronous, i.e. it does not run at the same time as another task).

We will therefore have to retrieve the elements of an RSS feed, retrieve the hashtags according to the content of the article retrieved via the RSS feed, transform the title of the article by including the hashtags previously retrieved, and tweet the transformed title. and the URL of the article on Twitter.

The trigger

To do this, we’ll start with the RSS feed task. Start by creating a Zap and use the “RSS by Zapier” application.

Then use the “New item in Feed” event for the “trigger”, and click “Continue”.

Then, you must give the link of the RSS feed (of your blog for example) to Zapier. You should also define what differentiates one item from another in your RSS feed, usually this is the Guid (Globally unique identifier), or the URL (which should not change from the post of the article). to its modification).

Finish the first step by testing the “trigger”, this will give you a list of articles retrieved via your RSS feed, and you will have to select the first (in our use case, if you wish to do otherwise, with an older article, you can do it). Click on “Continue” to proceed.

The webhook

We will now use Zapier’s “webhooks” to retrieve hashtags based on the content of the article. Find the “Webhooks by Zapier” app and use the “GET” action. Click on “Continue”.

Now, you have to use the URL of the Aylien API (if you don’t have an account, I invite you to create one now).

https://api.aylien.com/api/v1/hashtags

In the “Query String Params” section, you must add two entries, the first will be “url” which must contain the URL of the article retrieved via the RSS feed, the second will be “language” which must contain the language of the articles of your blog (detected by Aylien), I use French so I put “fr”, if you are not sure, you can set “auto” to automatically detect the language.

Leave the other defaults, we won’t send a request in JSON when fetching it from the result.

Now, in the “Headers” section, you will have to add two keys/values, the first will be “X-AYLIEN-TextAPI-Application-Key”, the ID of the application created on Aylien, the second will be “X-AYLIEN-TextAPI-Application-ID”, the API key of the previously created application. Click on “Continue”.

The JavaScript

We will now use JavaScript to transform our retrieved data. To do this, add an application called “Code by Zapier” and use the “JavaScript” language.

In the “Input Data” section, you will need to add three keys/values, the first will be “string”, the second will be “hashtags”, and the third will be “link”.

Match the “string” variable with the title of the article through the RSS feed. Then the “hashtags” variable with the hashtags retrieved via the “webhook”. Then the “link” variable with the URL of the article via the RSS feed.

Now let’s transform the text that will be tweeted with each new element of the RSS feed. For this, we are going to use “JavaScript”. Get the code below:

Then paste it in the “Code” section. I will now explain how it works. We retrieve the variables transmitted via the “inputData” object, so we can retrieve the title and URL of the article but also the hashtags generated by Aylien. We use the parse() function which allows us to rewrite the title of the article including the hashtags. Then, we build the tweet with these four elements:

  • the modified title
  • an emoji (which you can change)
  • three hashtags not used in the title
  • the URL of the article

We send back to Zapier the result of the code that transforms the title and builds the content, for the next step. Test if your code works (if you changed it). An error will occur if something does not go as expected.

Post the tweet on Twitter

To finish this Zap, we are now going to publish, not the title of the article and its URL, but the text that we have transformed via the “Code by Zapier” application.

Create a “Create Tweet in Twitter” action using the Twitter app, still in Zapier. Connect your Twitter account and choose the “Create Tweet” action.

In the “Message” section, you can enter the message of the Tweet that will be published, insert the “Tweet” variable of “Run Javascript” in “Message”.

Do not use the “ID” or “Runtime Meta Async”, which will be of no use to you. Which looks like this, if you add a hashtag in front of the tweet:

Finally, take a tour of your Zap, and check that everything is in order so as not to post anything on the Twitter platform. Click “Continue” and activate the Zap. Post a new post and wait 2 minutes for Zapier to post your post to Twitter with a beautiful headline and smart hashtags.

Here is a summary of the steps created in this Zap:

If you have any questions, a technical problem, or an idea to improve this tutorial, feel free to leave a comment below this article.

Obviously, this method works with other applications on Zapier, you can of course post content on your Facebook page or on LinkedIn by repeating almost the same steps as this Zap.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store