To get started streaming data from a Twitter feed, please follow to steps below.
To connect to Twitter:
- Create a Twitter developer account https://developer.twitter.com/
- Create a Twitter application
- For your application, locate the Account Secret and Account Token to be used for connecting to the API
Please refer to the following guide to deploy the Azure Infrastructure
Please refer to the following guide to deploy the required function apps used in this sample.
The Twitter feeds are consumed by an Azure WebJob that retains the connection to the Twitter API. To deploy the WebJob, please:
- Open the WebJob solution in VS Code or Visual Studio.
- Right click on the WebJob project and select to deploy as a WebJob
- Select to publish to exiting
- Log in with your Azure credentials
- Select the existing WebJob to publish to
- Select Publish
Once deployed, navigate to the WebJob in the Azure portal and make sure to update the application configuration values accordingly for the EventHub, Cognitive Services and Twitter secret parameters.
Key | Value |
---|---|
Tweet_Group_Key | Used as a grouping for Tweets (e.g. if you stream different keywords for the same project |
Twitter_Access_Token | Twitter Access Token, locted in the Twitter Developer console |
Twitter_Access_Token_Secret | Twitter Access Token Secret, located in the Twitter Developer console |
Twitter_Consumer_Key | Twitter Consumer Key, located in the Twitter Developer console |
Twitter_Consumer_Secret | Twitter Consumer Secret, located in the Twitter Developer console |
Twitter_Keywords | Comma-separated list of keywords to stream data for |
Twitter_UserToFollow | Comma-separated list of Twitter usernames to follow |
Cognitive_Service_Uri | Cognitive service URI, located in the Cognitive service blade in Azure |
Ocp_Apmin_Subscription_Key | Cognitive service subscription ID, located in the Cognitive service blade in Azure |
EventHub_ConnectionString | EventHub connection string, located in the Event Hub blade in Azure |
EventHub_Path | Event Hub namespace name |
Storage_Account_ConnectionString | Connection string to your Azure Storage Account, located in the Storage Account blade in Azure |
ApplicationInsight_InstrumentKey | Application Insight instrumentation key, located in the Application Insight blade in Azure |
Once the Azure Infrastructure has been deployed, open the Twitter Stream Analytics Job and paste in the Azure Stream Analytics query from here
Please refer to the following guide setting a Power BI dashboard and a streaming dataset
To start streaming Twitter feeds, please:
- Navigate to the WebJob and specify the keyword(s) to stream feeds for in the application settings
- Start the Azure WebJob
- Start the Function App if it is not already running
- Start Twitter Azure Stream Analytics Job (takes a couple of minutes to start running)