0.

That’s the mark I’d give to Facebook’s “quick start” guide for creating bots.

Frustration is good for you they said

Saturday morning. You want to learn about messenger bots because you read stuff here and there.

Ok. First stop would be to look at the product overview. Done. And then the guides: https://developers.facebook.com/docs/messenger-platform/guides

Seen on the /guides page

You’d be like: How great! 10 minutes to first running bot. Sounds good! Happy face. Hope. Sip of coffee. Insta selfie #hackingBots. etc.

Now let me tell you one thing: THAT’S A LIE. THEY’RE LYING TO YOU!!

I’ll try to prove it by giving you an honest picture of my experience on that page. There will be some swearing in French. 😘


0. Sample App

They invite you to download the sample app from Github. And they add “You can run the sample app to see it in action”.

You’ll actually HAVE to run the sample app if you want a bot. It’s not like you’ll build an app from scratch in 10 minutes right! Vous êtes sérieux là ?? 😘

1. Create a Facebook App and Page

They ask me to create a new App and Page or use existing ones.

Ok fair enough I don’t know why I need a Page but I can create a new App and a Page.

But what does it mean “use existing ones”? Like it doesn’t matter? Can I use a Page I’ve got for a live app? What will be the consequences? Putain c’est chelou ce truc quoi ! 😘

2. Setup Webhook

They ask to click “Setup Webhooks”. Ok done.

It’s followed by a superb “Enter a URL for a webhook”. Superb. Do you mind if I ask what URL? Can I put anything? Where can I find the URL? Est-ce que vous vous foutez de ma gueule ?? 😘

Chill out mec they’ll probably explain it later. Indeed they add “At your webhook URL, add code for verification […] Click Verify and Save […]”

Ok so I still don’t know what is my webhook URL and now my code should be doing stuff to verify the token etc. Oh look below that’s the snippet from the sample app, good they’re implementing the function we need. Ok so I guess I have to use their sample app, but HOW?

Paye ton tuto de merde !! 😘

I figured out that I have to go to the node folder of the sample app and then run npm install && npm start to get something running on .. localhost. So the webhook url should be the one of my local app (like http://localhost:5000) but obviously that’s not a public url so Facebook can’t verify it.

(You’ll get an error when running npm start because you need to add config variables in the default.json — which is super great because there are 4 mandatory variables in it and so far I’ve only read about the VERIFY_TOKEN so I don’t know what to put in the others. Does it matter? You have to find out. Mange merde. 😘)

Ok, so you need a public URL. Putain. I remember this tool ngrok I used in the past, let’s use it again: ngrok http 5000 
Brilliant, that gives me a public url that tunnels to my local web server.
I can now put that URL as my “webhook url” (trying not to forget to add /webhook at the end) and verification works. Cimer pour l’info ma gueule ! 😘

3. Get a Page Access Token

Ah! That’s why we need to create une putain de Page. 😘
They ask to select my Page and generate a token. Ok cool. I guess I should do something with that Token no? Right, that should go to this config file I guess!

Ça vous ferait mal au cul de rajouter une putain de ligne ?? 😘

4. Subscribe the App to the Page

Wow actually this step went smoothly. Well done. 🤐

5. Receive Messages

They explain some pieces of code from the sample app. That’s cool. 🤐

6. Send a Text Message

Do you mean a SMS? JK. The sample code is ok, they tell you to go your Page and to send a message. They tell you the page will echo back your message. They’re lying. Ils nous prennent pour des cons c’est tout ! 😘

When you try that, thanks to ngrok you have the log of your node app and you’ll see this Error: Couldn't validate request signature 
You go to the code, you find where it fails and you realize that you have to add a APP_SECRET 
I mean fair enough it’s not that hard to find that app secret and to put it on the config file. But is it reasonable not telling it upfront?

À qui profite le crime bordel de merde ?? 😘

7. Send a Structured Message

At this point you’re just tired. They said 10 minutes, but it’s been two days (exaggerating but who cares right). You cried. You removed the line of your CV where it said “Software Engineer”. You hate life.

Bravo les gars, bien joué. Franchement si c’est pour pondre de telles merdes, autant rester dans vos putains de baraques. 😘

The end.

Closing remarks:
- I actually have a lot of respect for Facebook. They changed my life with React. They have the best engineers on the planet. Period.
- Sorry for the swearing but sometimes it feels good to let it go.

Yes indeed