Overview of My Submission
I've never been a big Twitter user (social media at large), but that trend has changed since I discovered the world of technical writing.
I also discovered that, timely updates to most services I use are posted on Twitter, when they are down, back up, announcing new updates etc.
Also, many developers use it to share knowledge snippets (that I find useful) and their cool new programming endeavors.
We get your point, it is the Developers' town square, so what's all this about?
Well, in the spirit of sharing knowledge, and being inspired by a "currently" hobby project that I submitted to the first Dev Hackathon this year. I decided to set up a Twitter account that shares Dev Community content (soon to add content from other dev platforms) to the Twitter dev community, mainly beginner content.
I thought of setting up a bot to do the posting, but figured, it would lack a human touch as a bot would just post the same garbage it received.
I obtained daily dev content per the targeted languages set up on my-daily-reads and would filter them, add a human touch then post them.
Threads have been a big help, but a disappointment as well.
They are useful since I can compile posts then post them together, but the fact that I can't schedule them (since I am sometimes busy, or lazy) has been a set back.
To counter this problem, I've been storing drafts on Twitter's mobile app, then manually post the threads at the desired time. A very crude hack in the current state of tech.
I would assume to understand why Twitter wouldn't add scheduled tweets as a feature, something along the lines of needing people to be actively engaging in the platform and scheduled tweets will be antithetical to that model. (Maybe they have it exclusive to blue check-marks? Anybody?)
So, to entice my lazy (or productive) habits, I decided to create an app that enables me (and anyone else who'd favor) to schedule Twitter threads.
And what better way is there to do it than while learning a new technology, Appwrite in this case.
Building Scett
Setting up Twitter
To be able to send Tweets using the Twitter's API you need to register for a Twitter developer account.
After passing through the verification process for creating a Twitter Dev account, inside the developer dashboard add an app and fill in the necessary details.
Store the app id somewhere.
Inside your new app add enable OAuth 1.0a user authentication settings, choose the read and write permissions as Scett will be posting on behalf of Twitter users. Store the API Key, API Key Secret and Bearer Token somewhere safe as we'll be using them later.
Provide the required Callback URI / Redirect URL as well as the Website URL, well be needing the callback URI in the process of authenticating users in Scett.
In the case of the front-end in [Scett's Github repo] we are using - DOMAIN/twauth.
Add other information such as the app's description and and logo to help users know what it's about.
Setting Up Appwrite
Create a new Appwrite project and add a web platform.
Collections
Add the following collections with the respective attributes.
threads
Name | Type | Required |
---|---|---|
title | String | true |
postTime | Integer | true |
Tweets | String[] | |
userID | String | true |
Permissions:
- Read:
role:member
- Write:
role:member
twitterInfo
Name | Type | Required |
---|---|---|
handle | String | true |
token | String | true |
id | String | |
userID | String | true |
Permissions:
- Read:
role:member
- Write:
role:member
Functions
Add two functions and create api keys for them respectively.
The functions code is included within the project's repository.
Twitter Oauth
This function will be used in the Twitter's oauth 3-legged flow for user authentication.
Its API key only needs the execute permission.
Add the following environmental keys to this function.
- ENCRYPTION_SECRET - a 32 character String which will act as the salt to encrypting our user tokens. We will be encrypting the tokens before saving them to the twitterInfo collection.
- TW_OAUTH_FUNCTION_API_KEY - Api key we generated for this function.
- TWITTER_AUTH_REDIRECT_ENDPOINT
- TWITTER_API_KEY - Obtained from out twitter app.
- TWITTER_API_KEY_SECRET - Obtained from out twitter app.
Tweets Envoyer
This function will be used in the Twitter's oauth 3-legged flow for user authentication.
Its API key needs document read and right and function execution permissions.
Add the following environmental keys to this function.
- ENCRYPTION_SECRET - Same as above
- TW_ENVOYER_FUNCTION_API_KEY - Api key we generated for this function.
- TWITTER_API_KEY - Same as above
- TWITTER_API_KEY_SECRET - Same as above
- TWITTER_INFO_COLLECTION_ID - Collection id of our twitterInfo collection
- APPWRITE_ENDPOINT - Endpoint of our appwrite project
- APPWRITE_PROJECT_ID - Project id of our appwrite project
Configure the cron job to run after a certain period of time that isn't likely to violate the twitter API limits. For Scett I have set this to every five minutes, thus the threads too can only be scheduled in steps of five minutes throughout the day.
Front End
Scett's Front-end is made in Vue3, using the src script sugar.
Clone it from github:
git clone https://github.com/xinnks/scett.git
cd into it and run npm install
on your terminal.
Submission Category:
Web2 Wizards
Link to Code
Here is Scett on github.
Scett
Scett helps you schedule your twitter threads.
Scheduled Twitter Threads
Powered By
Additional Resources / Info
Scett is powered by the following open source projects.
Top comments (0)