shubham lashkan
Shubham Lashkan

Follow

Shubham Lashkan

Follow
Twitter OAuth: A Developer's Nightmare

Twitter OAuth: A Developer's Nightmare

A frustrating end to creating my own Tweet Scheduler

shubham lashkan's photo
shubham lashkan
ยทMar 11, 2023ยท

4 min read

Play this article

Table of contents

  • About the Project
  • About the Error
  • What Steps i took?
  • New Day, Fresh mind & Authorized
  • Conclusion

Hey guys i love coding because it gives you power to develop custom solutions for yourself and you don't have to pay for it as well. Sounds like clear win win situation but sometimes things doesn't go as planned and you get frustrated and leave that side project and start working on other and that might add one more uncompleted project in your github profile.

In this article i will share my complicated relationship with Twitter APIs.

About the Project

I was working on a personal project where i need to integrate Twitter with Salesforce so that i can save my tweets in Salesforce and schedule them in advance to save time.

I started working on this project last year in the month of april to be more precise and completed at the end of June.

About the Error

I don't exactly remembered the error message but i am sure i was facing some issue while generating Authentication Header. If you have worked with Twitter APIs and expecially the authentication part then you will agree with the title of this article.And if you haven't worked with Twitter APIs have a look at the steps to generate a signature here and you will say also agree with me.

What Steps i took?

Like every developer i also googled for it and went straight to Stack Overflow and it didn't helped me. I also checked lots of github repos to understand what i am doing wrong that didn't worked either.

One day i was scrolling twitter and saw a tweet from this guy named Hirvesh. He was also building an application named Outlater to schedule tweets so i connected with him if he might have come accross the same problem and found out that he was using some library to implement the same and i was coding it from scratch.

So that conversation didn't helped either so i thought of giving up the idea of developing that app and stop wasting my precious time.

New Day, Fresh mind & Authorized

You might have read this line thousand of time that "Every new day brings with it another chance to change life ." So on a weekend i was getting bored so i thought of giving that project one more try because that is more exciting instead of getting bored and wasting time.

So i logged into my Salesforce Org run the code without changing any line of code expecting some kind of miracle like every other developer but that's not how you get things to work for you.

I opened the Twitter API docs and compared the steps to generate authentication header with my code and i have found out that i was doing some noob mistakes like not encoding the strings and missing = sign etc.

I did the required changes in my code and tried tweeting some random tweets and it worked. You can see screenshots of some tweets below.

Link to all the test tweets which I tried from salesforce.

Conclusion

Working with Twitter API was frustrating and it sucked but once i was able to decode the issue it rewarded me a lot. I have saved all the tweets in Salesforce and Scheduled them to post at different time of the day in advance.

The biggest learning while dealing with it is you can solve any problem with Patience, Willingness along with never give up attitude.

I hope you all enjoyed my debugging story.

If you ever get stuck with any bug i would recommend you first go through the official documentation and if it didn't help then you can go to StackOverflow or ChatGPt.

Please don't forget to like, comment and share and you can also check out my other articles. Also, don't forget to subscribe to my newsletter so you can be notified about new articles.

I am looking to get into technical writing so if you want me to write an article then please connect with me on my Twitter handle here.

Let me also know which topic I should write about next.

Did you find this article valuable?

Support shubham lashkan by becoming a sponsor. Any amount is appreciated!

Learn more about Hashnode Sponsors
ย 
Share this