Wednesday, 15 July 2020

Build Your Own Twitter Bot - Project Setup

<< Introduction                                           Table of Contents                                                                    Retweeting >>

Prerequisites


Before we begin building our Twitter Bot, you need to have the following:

We will be creating the following solutions and project structures:
  • OccultTwitterBot
    • OccultTwitterBot
    • OccultTwitterBot.Console






  • TwitterBotService
    • TwitterBotService
    • TwitterBotService.DAL



OccultTwitterBot Project

1. In Visual Studio, create a new AWS Serverless Application project:



We will call our project 'OccultTwitterBot'

This project will contain the logic for our AWS Lambda functions (Tweet, Retweet and Unfollow)

2. Select Empty Serverless Application:



3. Click Finish.

You will now see an empty project containing the following items:

Function.cs - The FunctionHandler in this class is what will be triggered by our Cloudwatch event.

serverless.template - This is our AWS CloudFormation template which is responsible for defining the resources we will require, so that AWS will know what to provision. We will be using this for defining our three Lambda functions.

4. Ensure you have the following Nuget packages installed:





TwitterBotService Class Library

(I recommend creating this in a separate solution) Create a new .Net Core class library project called 'TwitterBotService'. This will act as our TweetInviAPI wrapper which will cater for our specific TwitterBot needs.

Install the following Nuget packages:




TwitterBotService.DAL Class Library

Create a new .Net Core class library project called 'TwitterBotService.DAL'. This will be our Data Access Layer for querying and updating Tweets to our DynamoDb table.

Install the following Nuget packages:




Finally, add the TwitterBotService and TwitterBotService.DAL references to the OccultTwitterBot project.




We should now have the skeleton project structure ready. Now let's move onto the fun stuff!

<< Introduction                                           Table of Contents                                                                    Retweeting >>


No comments:

Post a Comment