This Bot Downloads Media from any Tweet and Set Reminders for Future reference

This Bot Downloads Media from any Tweet and Set Reminders for Future reference

This is a submission for the Coze AI Bot Challenge: Bot Innovator.

What I Built

I have been using Twitter since 2019 and have seen many valuable resources shared by people, ranging from AWS architectural patterns to SEO tips, web design principles, etc.

The highlight often is the media associated with it, which could be a representation of a diagram or a video explanation.

I often do what we’ve always done: bookmark it for future reference. The problem is, most of us never come back. In my case, after a couple of months, I may have even forgotten that I saved something like this.

I even wondered if it would have been great if the bookmarking feature also had some kind of reminder mechanism that I could schedule, like ‘remind me next month,’ etc.

Sadly, Twitter (Now X) hasn’t rolled it out yet.

This is where TweetMediaManager comes to the rescue.

You can send a Tweet URL that looks something like this to the bot:
https://twitter.com/<username>/status/<id>

And later, this is what happens:

But that’s not just it. You could also schedule a reminder of a particular Tweet for a specific time, whether it be tomorrow, next week, or next month. That’s up to you.

For example:

We’ll see a live demo of both of these examples in a sec 😉

I’m preparing for the AWS Solutions Architect exam, and this is going to help me a lot because there are some awesome developers on X who are sharing really valuable tips, including diagrams, gif representations of some internal processes, etc., from time to time.

Even if you’re not preparing for any exams, you could still use this for many different purposes. The possibilities are endless and unique to each of you.

// Detect dark theme
var iframe = document.getElementById(‘tweet-1782169943540400148-300’);
if (document.body.className.includes(‘dark-theme’)) {
iframe.src = “https://platform.twitter.com/embed/Tweet.html?id=1782169943540400148&theme=dark”
}

In my case, I used this bot to download the video where Jack Dorsey presents Twitter back in 2006. This simple video motivates me to work harder and keep going.

Demo

You can check out TweetMediaManager bot from Coze store. It’s also available on Discord and Telegram.

Configuration

Journey

Learning something new is never easy for anybody and it did took some time to get the whole Coz workflow for building an AI chatbot.

For this particular bot, none of the currently available plugins were able to bring my idea to life. So i have to build one which in this case i had to use the Twitter API v2 Tweet Lookup endpoint with some extra parameters and expansions to get the media (both image and video) from a tweet.

Unfortunately i was having a hard time to figure out how to create this custom plugin and configure it to make a call to Twitter API v2 since it required Oauth 1.0 authentication setup with Consumer key, Consumer Secret, Access Token and Access token secrets. Bearer token aren’t used anymore for most cases

So i had to either drop this idea or move on with another one. which i couldn’t. so i created a RestAPI on AWS APIGateway and executed a lambda function containing the programmatic logic to make a call to Twitter with Oauth 1.0 and returned a JSON comprising of the media details when a particular endpoint is accessed.

After a couple of hours of publishing TweetMediaManager i saw the users count increasing, which did made me worry and happy at the same time because to access the Tweet Lookup endpoint (to get media) i needed a Paid API plan from twitter so i choose the $100/mon plan for my use case. But the main problem was the rate limiting issue (429 error). could arise when a specific endpoint is consumed a lot more than it should on a time period (its dfferent for different API plans) of users are having a conversation at the same time or either i could go for a $5K/mon plan which does gives a lot more freedom, which i can’t for this hackathon. if Coz could help, I’m definitely gonna make this plugin production ready so you can all utilize it for any number of bots.

The videos on CozHQ official Youtube channel was very helpful for starters for building, utilizing different skills, publishing it to various channels like Telegram etc.

Most importantly the Live Stream on April 22 was really awesome, Joshua and Zara helped me to clear lot of my doubts in that available time frame. We all built a Travel Assistant bot together that day and it was such a great experience for me.

Lastly, best of luck to all contenders of Coz AI hackathon, feel free to share your projects on X with a mention to @SamuelSojin.

I’m psyched to test all of your amazing hackathon submissions.

Peace ✌️

Leave a Reply

Your email address will not be published. Required fields are marked *