As illustrated in this article I have used the Facebook Messenger API through which the user can communicate with the bot. Naturally, data is fed through the API. The training data is used to train the Random Forrest Classifier model. I hope this answers your queries. I do recommend cloning the repository and trying it yourself to get better clarity.