TIP
💡 Learn more : Azure Logic Apps Documentation (opens new window).
# Use Azure Logic Apps and Cosmos DB to monitor and archive Twitter hashtags
I love data and use it constantly to improve everything in my personal life as well as my professional life. As we are about to begin the Microsoft Ignite conference, I wanted to collect tweets that use the #MSIgnite hashtag and save them to a database. I also don't want to code as I'm working on 3 sessions right now. Here's how I did it.
# Create an Cosmos DB instance
Inside of the Azure Portal, create a Cosmos DB instance.
For Cosmos DB :
- Use SQL for the API
- For Database ID use cosmosdb-ignite
- For Collection ID use items
- Throughput use 400
![](/AzureTipsAndTricks/files/azlogiccosmos1.png)
![](/AzureTipsAndTricks/files/azlogiccosmos3.png)
# Create an Logic App instance
Inside of the Azure Portal, create a Logic App instance per the screenshot below
![](/AzureTipsAndTricks/files/azlogiccosmos2.png)
# Logic App Designer
Open the Logic App that you just created and select When a new tweet is posted and log in with your Twitter credentials and select the interval and text you wish to search for. In my case I'm using #MSIgnite.
![](/AzureTipsAndTricks/files/azlogiccosmos4.png)
Choose an action that is Create or update document
![](/AzureTipsAndTricks/files/azlogiccosmos5.png)
Provide the Connection Name (anything you want) and the account you wish to use.
![](/AzureTipsAndTricks/files/azlogiccosmos6.png)
Fill out the following fields:
- For Database ID use cosmosdb-ignite
- For Collection ID use items
- For Document use:
{
"created": @{triggerBody()?['CreatedAtIso']},
"id": @{triggerBody()?['TweetId']},
"text": @{triggerBody()?['TweetText']},
"user": "@{triggerBody()?['TweetedBy']}"
}
2
3
4
5
6
Please note that these are dynamic fields, so you might not be able to copy and paste that text.
![](/AzureTipsAndTricks/files/azlogiccosmos7.png)
Click Save and then go into your Cosmos DB Instance and you can query the database to see the data coming in.
![](/AzureTipsAndTricks/files/azlogiccosmos8.png)