DEV Community

Marcel Czuryszkiewicz
Marcel Czuryszkiewicz

Posted on

My 3 Years of Dealing with Social Media APIs (And Why I Am Losing My Hair)

Well, three years into building and maintaining social media integrations, and I still haven't gotten used to the sheer paranoia of hitting "deploy." I've been doing this for a long time now, and at this point, you'd think my body would've accepted that undocumented API changes are just part of the job.

aaaand It has not.

Writing new features isn't the worst now, but maintaining them is hell, because sometimes (a lot of the time) platforms decide to throw in undocumented errors or, worse, a change (Im looking in the direction of LinkedIn). Before we started this, I was doing a lot of backend work and AI development, so I had a pretty good grasp on error handling

But no. I got dropped into a world where platforms communicate in riddles, HTTP status codes are mere suggestions, and treating every failure the same way means your customers' followers get spammed with the exact same post five times in a row, but this is still not the worst part.

I don't know if you know this guy here:


but he is running a channel called Xiaomanyc, basically a polyglot channel (guy speaks a lot of languages). Social Media platforms are the same, 5 out of 15 integrations that we have return errors in diffrent languages, so we have a translation map to deliver unified error messages in plain English. The languages we have right now are Korean, Japanese, Russian, Deutsch, French, and Spanish

A lot of my work over the last three years has revolved around one single question: Retry, or give up?

There aren't many moments where you can just go, "hmm, let's just retry aggressively and see what happens." The system exists, people depend on it, and the mistakes are not symmetrical.

If you retry a terminal error, it’s annoying. You burn through your rate limits, the eventual failure notification gets delayed, and you waste time. But it's recoverable.
If you retry a non-idempotent success—meaning the platform did accept the post but the network dropped before they could tell you—congratulations. You just published it twice. Your customer is now dealing with refund conversations, angry followers, and an outright spam flag on their account. Or my favourite one, post is made, the platform returns a 500 code so the client tries again and then magically the old post is processed and published, but the new one is still incoming, messing the whole thing up.

The three buckets of doom

When an API fails, the error goes into one of three buckets: Retryable, Terminal, or Unknown. And that third bucket is exactly why I'm 26 but have the hairline of a stressed-out 40-year-old. I'm using minoxidil daily...


Im a crisp 3.

I might get a random string back from an endpoint. There's a manual we try to build internally telling us which fields to check. But then there's this little voice in my head going, "Okay... but what does this error actually MEAN man?"

Why did they return a 200 OK with a fail message inside the JSON?

And more times than most the answer is:
I DON'T KNOWWWWW.

We (rather I) actually ended up writing a deep dive on Social Media API Error Handling with the exact error code matrices we use in production if you want to see how deep this rabbit hole goes. Non-fluff version with platform split is here

I don't know what the final lesson is yet, and maybe that's the most honest way I can end this. I'm still in the middle of it. I'm still maintaining that cursed error classification table and still wondering when my hair will stop falling out.

Maybe the lesson is just that your job doesn't always give you the exact technical experience you thought you were going to get. Sometimes it gives you a masterclass in defensive programming and sheer survival instead.

Keep your head up, Marcel

Top comments (0)