DEV Community

loading...

text2imagge

vjnvisakh profile image Visakh Vijayan ・2 min read

It all started with an excellent by a fellow dev enthusiast on this platform. He had the idea to fetch programming quotes using github actions. This got me wondering, if there is an API to get free quotes why not use it to post to social media platforms on a daily basis.

All I have to do is get permissions from Facebook, LinkedIn, Twitter and Instagram and run a cron job to post to these sites every day at a particular time.

It seemed damn simple. Only hopes were destroyed when -

  1. All the social media platforms have switched to Oauth 2.0. This means you can't just directly access their APIs using an email and password, you need an access token to do so. Fair enough.

  2. Second pain was the expiry time, while LinkedIn and Twitter gave expiry times for around 60 days, facebook gave it for 3 hours. Found out they have something called an access token expiry extender :|

  3. The publish_action scope which is needed to post photos was deprecated in April, 2018. There, the end of Facebook.

  4. LinkedIn makes it weirder. They need you to create a company to actually start developing apps on their platform. And that too, the scopes have to be approved by the team and you will be informed via mail if they feel it's okay to approve. :| Ok ... so waiting for LinkedIn

  5. Twitter has straighforward APIs. You have a bearer token. You use to it to make a tweet(photo upload). Only, you have to first upload the media to twitter and then use the media in a tweet. Strange. Facebook allowed you to create a pic from a URL. But yeah, facebook is no more :'( Oh! and the default scopes don't allow media post. So submitted for a review. Waiting for another email.

  6. Instagram, well after all these attempts ... I shifted my focus from there and finally made this silly looking thing -

https://text2imagge.herokuapp.com/

So yeah, wasted a lot of time. :D Saturday sorted !

Discussion

pic
Editor guide