V
V
Valentine2016-08-25 10:32:49
Facebook
Valentine, 2016-08-25 10:32:49

How to automate FB bot development?

A very pressing question.
There is pooling in telegram, everything is kosher there, but I haven’t figured it out with FB yet.
We write a bot for Facebook. It requires a certificate and a webhook url.
I have two working machines (work - home) + server with SSL certificate, code in SVN on the same server.
IP dynamic.
On the server, the bot (what has already been implemented) works fine, everything is set up.
BUT! How to debug? Copying scripts all the time to the server by hand is not an option.
How to automate bot development?
Is there an option to run it on a local development machine?
Or maybe gulp is somehow possible? Then on the server you need to restart automatically.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2016-08-31
@zoonman

Proxy requests through ngrok to the local server https://ngrok.com/
Then mirror the traffic to the local machine https://goreplay.org/
Make an SSL certificate for the production server. For example, you can get it from cloudflare for free and Facebook definitely works with it (I use it myself).
Next, you need to do a simple thing - make a simple script that will simply add requests from Facebook to the database raw (just parameters and text from php://input).
Then you make a local script that simply accepts raw text as input and debug it.
It turns out you have 2 pieces - the receiver and the handler. The receiver turns out to be very simple (there are literally 10 lines).
Well, you are already debugging the handler by submitting text from the database as input.
I’ll say from experience that sometimes Facebook doubles events, sometimes it misses. It's rare, but it does happen, so you can't rely 100% on webhooks. Keep this in mind.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question