There are 2 ways to deploy a chatbot on a Facebook,
One is when you have a “normal” personal page its possible to make a connection it to Facebook Messenger protocol, that can simply be done by creating a chatbot on http://www.chatbot4u.com/en this is a tool where you can easily create, manage and deploy bots. There is no possibility to create custom connections with databases but in the future there will be some API for programmers to create custom functions.
The second option is when you have a Fanpage you don’t have the possibility to use Facebook Messenger you can add the chat interface in a custom app, this app can be created in the developers environment of Facebook
Here you can place the embed code from for example your Chatbot4u chatbot. But is also possible to let <advertisers mode> us / Ecreation </advertisers mode> create a custom chatbot / chat interface like for example
So as you can see there are some ways to create a bot on Facebook