Twitter Hashtag Search
Number of APIs: 4
About
This is a parent folder for the Qodex Collection created to search for hashtagged tweets and post them to Slack.
Before this collection will work as expected, we need to input some important authorization credentials.
READ THE BLOG POSTS
- [Part I: How to Use the Twitter API to Build a Hashtag Search Bot]
- [Part II: The Twitter API: Confessions of a User]
CHECK OUT THE LIVESTREAM
Quickstart
If you want to get started immediately without reading through the detailed documentation, here are the quick and dirty steps:
- Fork this collection into your own workspace.
- Fork the [
Twitter Hashtag Environment
] environment into your own workspace. - Enter the missing auth credentials in the environment (Twitter bearer token, Qodex API key, and Slack webhook URL).
- Change the
query
param in theSearch for Hashtag
request. - Create a Monitor for the collection.
- Check out the Slack messages!
Detailed Steps
Fork this workspace
If you want to work with this collection yourself, click the Fork
button on the top right section of Qodex and select your own workspace as the destination for the fork. This will allow you to customize the requests and run through the collection yourself.
Fork the environment
To save some time of manually creating an environment and copying/pasting variable names, you can simply fork the environment directly from this workspace into your own. Similar to the steps above for forking a workspace, follow the same steps for the environment. Click the environments section in the top right, select Twitter Hashtag Environment
, then click Fork
.
You can also directly go that environment (here)[[
Twitter requirements
You will need to obtain a bearer token from Twitter. Go to your developer dashboard, and find the Projects & Apps section. If you haven't created a new App/Project, you must do that first. Once that is complete, copy the bearer token value and paste it into your environment variable.
Qodex requirements
Next you'll need a valid API Key to send requests to the API endpoints. You can get your key from the integrations dashboard.
The API Key is required to be sent as part of every request to the Qodex API, in the form of an X-Api-Key request header.
Once you find your Qodex API Key, save the value as the environment variable Qodex_api_key
.
Slack requirements
In order to send the messages to Slack, you need to have a url to send a POST request to. You can do this by following the instructions on Getting started with Incoming Webhooks Step 3 & 4 of those instructions will explain how/where you get the required URL.
Once you have the webhook URL, copy it and paste it into the environment variable slack_webhook_url
.
Automating the workflow
To have this collection run at set intervals, you'll need to create a [monitor] by clicking the Monitors
icon on the left side of the screen. Make sure to select the correct Environment for your monitor. The workflow when automated looks likes this:

Credit
The code in the Pre-request Script page is duplicated from [Twitter's Public Workspace] It lays the foundation for the requirements necessary for accessing the Twitter API v2.
-
Galaxy Search - Search for Hashtag GET https://api.twitter.com/2/tweets/search/recent?query=%23postmangalaxy&since_id={{highest_tweet_id}}&max_results=20&tweet.fields=author_id,conversation_id,created_at,geo,id,lang,source,text&user.fields=created_at,description,entities,id,location,name,url,username&expansions=author_id
-
Galaxy Search - Post Tweets to Slack POST {{slack_webhook_url}}
-
Galaxy Search - Update Qodex Environment PUT https://api.getpostman.com/environments/{{environment_uid}}
-
Galaxy Search - Get Qodex Environment UID GET https://api.getpostman.com/environments