Search tweets by keywords and post it on Slack

This workflow searches your Twitter tweets using specified keywords or # tags and sends them to a specific Slack channel.

To set up this integration, you will need to use the following:

  • Twitter - Search Tweet action
  • Slack - chatPostMessage

Add and configure Twitter - Search Tweets action

Add Twitter connector to the canvas and connect it to the Start icon.

Next, double-click the Twitter connector icon, select the Search Tweets action from the Select Action drop down list, and select the Twitter account you want to use to execute the action.

twitter.PNG

Once this is done, click Next.

In the configuration page that appears, enter values for the input fields as per the instructions given below:

Search Keyword: Enter the keyword by which you want to search the tweets.

Count: Specify the maximum number of results you want to retrieve per page. The default value of this field is 15.

search_tweets.PNG

Once you have entered all the details, click on Next, Test the action, and click Done. This will take you back to the canvas.

Add and configure Slack - chatPostMessage action

Add Slack connector to your canvas, and connect it with the previous action. 

Next, double-click the Slack connector icon, select the chatPostMessage action from the Select Action drop down list, and select the Slack account you want to use to execute the action.

Once this is done, click Next.

Configure this action and enter a value in the fields as per the instructions given below:

channel: Enter the ID of the channel on which you want to post the message.

Text: Add the output key, say {{$a6.statuses[0].text}}, listed under the array output on the left-side of the configuration window as an input for this field.

14-slack.png

Once you have entered all the details, click on Next, Test the action, and click Done to return to the canvas. Connect this action to the Stop icon and SAVE the action.

Now, whenever you execute this workflow, it will search Twitter for the tweets containing specified hashtags and will post the tweets matching the criteria on the specified Slack channel.