- Saved searches
- Use saved searches to filter your results more quickly
- License
- adeshpande3/Facebook-Messenger-Bot
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Saved searches
- Use saved searches to filter your results more quickly
- License
- hult/facebook-chatbot-python
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- Saved searches
- Use saved searches to filter your results more quickly
- License
- the-javapocalypse/Chatbot-For-Facebook
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Facebook chatbot that I trained to talk like me using Seq2Seq
License
adeshpande3/Facebook-Messenger-Bot
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
The FB Messenger chatbot that I trained to talk like me. The associated blog post.
For this project, I wanted to train a Sequence To Sequence model on my past conversation logs from various social media sites. You can read more about the motivation behind this approach, the details of the ML model, and the purpose of each Python script in the blog post, but I want to use this README to explain how you can train your own chatbot to talk like you.
Requirements and Installation
In order to run these scripts, you’ll need the following libraries.
How You Can Train Your Own
git clone https://github.com/adeshpande3/Facebook-Messenger-Bot.git
- Facebook Data: Download your data from here. Once downloaded, you should have a fairly large file called messages.htm. It’ll be a pretty large file (over 190 MB for me). We’re going to need to parse through this large file, and extract all of the conversations. To do this, we’ll use this tool that Dillon Dixon has kindly open sourced. You’ll go ahead and install that tool by running
pip install fbchat-archive-parser
fbcap ./messages.htm > fbMessages.txt
This will give you all your Facebook conversations in a fairly unified text file. Thanks Dillon! Go ahead and then store that file in your Facebook-Messenger-Bot folder.
[20.06.19, 15:58:57] Loris: Welcome to the chat example [20.06.19, 15:59:07] John: Thanks
12/28/19, 21:43 - Loris: Welcome to the chat example 12/28/19, 21:43 - John: Thanks
- Now that we have all our conversation logs in a clean format, we can go ahead and create our dataset. In our directory, let’s run:
- Build the server, and host on Heroku.
- Create a Facebook App/Page, set up the webhook, get page token, and trigger the app.
- Add an API endpoint to index.js so that the bot can respond with messages.
After following the steps correctly, you should be able to message the chatbot, and get responses back.
In this app.py file, we want to create a route (/prediction in my case) where the input to the route will be fed into our saved model, and the decoder output is the string that is returned. Go ahead and take a closer look at app.py if that’s still a bit confusing. Now that you have your app.py and your models (and other helper files if you need them), you can deploy your server. We’ll be using Heroku again. There are a lot of different tutorials on deploying Flask servers to Heroku, but I like this one in particular (Don’t need the Foreman and Logging sections).
- Once you have your Flask server deployed, you’ll need to edit your index.js file so that the Express app can communicate with your Flask server. Basically, you’ll need to send a POST request to the Flask server with the input message that your chatbot receives, receive the output, and then use the sendTextMessage function to have the chatbot respond to the message. If you’ve cloned my repository, all you really need to do is replace the URL of the request function call with the URL of your own server.
There ya go. You should be able to send messages to the chatbot, and see some interesting responses that (hopefully) resemble yourelf in some way.
Please let me know if you have any issues or if you have any suggestions for making this README better. If you thought a certain step was unclear, let me know and I’ll try my best to edit the README and make any clarifications.
About
Facebook chatbot that I trained to talk like me using Seq2Seq
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
A simple python chatbot for Facebook messenger
License
hult/facebook-chatbot-python
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
A simple python chatbot for Facebook Messenger.
The bot reads incoming Facebook Messenger messages, and responds by generating random text from a corpus. The length of the response is randomly selected around the length of the incoming message, and a random word from the incoming message is selected as the starting word of the response.
Use of virtualenv is highly recommended, especially since the old version of nltk used requires an old version of setuptools .
$ pip install -r requirements.txt
Setting up a Facebook app for Facebook messenger
- You’re going to need a publicly routed https address. I used ngrok to create a tunnel to my local development machine.
- The server will need to be started for you to verify the webhook. See «Starting the server» below.
- Follow the instructions provided in the Facebook quickstart tutorial for creating a page and an app.
- Set the VERIFY_TOKEN and FACEBOOK_TOKEN environment variables to the values you get from following the tutorial.
Before you start the server, there has to be a file called corpus.txt in the root directory. This can be any text, but I found it interesting to use all of my sent emails as the corpus.
If you have your emails in mbox format (you can get them from Gmail using Google Takeout), you can use the provided mail_corpus.py to build a corpus.
$ python mail_corpus.py emails.mbox youremail1@example.com youremail2@example.com .
This will grab the text from all emails from the specified addresses (it tries to not include text responded to, signatures and so on), and create a corpus from it.
- A big corpus takes a loooong time to load
- Tests
- Send structured messages
- Handle postbacks
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
A simple Chatbot for Facebook’s personal profile that can chat with any of your friends in python using fbchat & dialogflow/Api.ai
License
the-javapocalypse/Chatbot-For-Facebook
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Chatbot For Facebook Personal Profile in Python
A simple Chatbot for Facebook’s personal profile that can chat with any of your friends and reply to them. Complete text and video based detailed tutorial link
You will need to register a free account on dialogflow. After that you need to create an agent and train it (how to create and train an agent using dialogflow). After that copy Client Access Token somewhere because we will be needing that later.
Download or Clone the repo, Navigate to the directory containing the files and run
or if you have different versions of python installed then
to install the dependencies.
Note: If you’re facing problems in installation of fbchat in Ubuntu then run the following command.
sudo apt-get --yes --force-yes install libxml2-dev libxslt1-dev libxml2 python-dev python3-dev zlib1g-dev
After running setup.py, open bot.py and plug in your Client Accecss Token, email and password and run the bot. Now you can test the bot by logging into some other facebook account and starting a chat with the account you used to run the bot.
- Fork it
- Create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am ‘Add some feature’
- Push to the branch: git push origin my-new-feature
- Submit a pull request
This project is licensed under the MIT License — see the LICENSE.md file for details
About
A simple Chatbot for Facebook’s personal profile that can chat with any of your friends in python using fbchat & dialogflow/Api.ai