DEV Community

Discussion on: A bot that tweets new DEV articles about Vue

Collapse
 
frontendwizard profile image
Juliano Rafael

Loved it. Awesome article. I’ve used puppeteer for automations like this before but it’s usually an overkill. I’ll try to replicate this by building a bot for React :) Thank you for the article.

Collapse
 
danielelkington profile image
Daniel Elkington

Thanks for the kind words; all the best with your bot!

Collapse
 
frontendwizard profile image
Juliano Rafael

Bot up and running on azure as well. The twitter profile is twitter.com/TheReactDev. I'll wrap it up tomorrow and put the code on GitHub. This stuff is fun!

Thread Thread
 
frontendwizard profile image
Juliano Rafael

One thing to note is that checking the extended_url didn't worked for me. Sometimes the twitter api handles me a twitter.com link instead of a dev.to link. Any ideas on why?

Thread Thread
 
danielelkington profile image
Daniel Elkington

Do you mean the expanded_url in tweet.entities.urls? I didn't have this problem 🤔. If you get stuck feel free to put your code on GitHub and I'm happy to take a look!

Thread Thread
 
danielelkington profile image
Daniel Elkington

@frontendwizard Just saw your React bot - it looks great! Especially like how you turned the dev.to tags into Twitter hashtags. Great work.

Thread Thread
 
frontendwizard profile image
Juliano Rafael

Thanks. Yeah, I mean the tweet.entities.urls. For some posts it does not return the dev.to url but instead returns a twitter.com link to the own link. I ended up fetching the tweets on extended mode and checking the title + author on the full_text. Not great but, it works.

Thread Thread
 
frontendwizard profile image
Juliano Rafael

I found the problem. You have to ask for the tweets with tweet_mode: "extended" on the statuses/user_timeline endpoint, otherwise you don't always get the posted url. Might be a quirk of the twitter API, I'm not sure about it. Was writing about this when I finally understood the behavior. That's why writing about what you're doing is so important! 😄

Thread Thread
 
frontendwizard profile image
Juliano Rafael • Edited

btw, the code is on Github now: github.com/thefrontendwizard/TheRe...