This project shows how to deploy a facebook echo bot Vert.x application to Heroku. The same application can be deployed using a one-click badge, the maven plugin, or the git interface.
If you use a fat-jar then deploying on Heroku is as simple as a click. The only requirement is to create a Heroku specific Procfile with a
Dyno of type
$ sudo apt-get install -y git
$ sudo apt-get install -y maven
$ git clone https://github.com/jboss-outreach/facebook-echo-bot
Heroku is a cloud platform that allows developers to build, run and operate applications entirely in the cloud. A limited, free tier is available for trying out this app.
There are 3 approaches to deploying the app:
$ heroku create
$ mvn package heroku:deploy
$ heroku create
$ git push heroku master
$ mvn clean package $ java -jar target/facebook-echo-bot-3.5.0-jar-with-dependencies.jar $ ./ngrok http 8080
chmod +x filenamein Linux or MacOS. For Windows, run Command Prompt as administrator.
Properties must be configured before the app can be accessed:
facebook.verify.token # You have to decide. This value has to be the same for both the app and Facebook. facebook.access.token # This is used to send pi hits to Facebook on your behalf. http.port # This is 8080 by default. http.address # This is 0.0.0.0 by default.
One method of setting the properties is by the command:
$ java -Dhttp.port=$PORT -jar target/facebook-echo-bot-3.5.0-jar-with-dependencies.jar
When creating a project of your own, you'll need to borrow from the
Procfile in the root directory of this project, and the
MAVEN_CUSTOM_OPTS will only be necessary if your app is not the primary module of your Maven project.
A Video Demonstration is uploaded to
Youtube which can help to setup Facebook Echo Bot on any cloud.
The app's web hook is at
For Heroku-deployed apps, it is at
Refer the following link to set up your Facebook app:
The first thing to do is create an account on GitHub (if you do not have one yet). You should then read the rules of participation in the development for the project you selected. These rules are usually found in a file called CONTRIBUTING.md in the root of the repository. This repository does not have it yet.
Usually, there are several ways to participate in the development of a project. The main ones are to send a message about some error or desired improvement (Submitting Issue), or directly creating a Pull Request with your correction or improvement (Code Contributing). You can also participate in the improvement of documentation, answers to questions that have arisen from other developers, and much more.
Make your way to the project page and click on the button that says Fork. This command will create your own copy of the project's repository in your github account.
After forking thr git, the next thing you need to do is to clone (ie. copy or download) the repository onto your local machine, this can be done by:
$ cd ~/work/git #folder in which there will be a code $ git clone https://github.com/[YOUR-USERNAME]/facebook-echo-bot.git #clone repository
Next, you need to make a small adjustment to your Git, so that when you send commits, your name will be displayed. For this it is enough to execute these commands:
$ git config --global user.name "Your name" $ git config --global user.email firstname.lastname@example.org
Next, you will need to link remote repositories to git, remote repositories are nothing but versions of your project that are hosted on the internet or network somewhere (in this case, the jboss-outreach main repository). You can add this by setting the upstream (preferably) in your git local repository. This can be done by:
$ git remote add upstream $ https://github.com/jboss-outreach/facebook-echo-bot.git
To check if the previous step was successful run:
$ git remote -v
If the process was successful, you would see the following output:
origin https://github.com/[YOUR-USERNAME]/facebook-echo-bot.git (fetch) origin https://github.com/[YOUR-USERNAME]/facebook-echo-bot.git (push) upstream https://github.com/jboss-outreach/facebook-echo-bot.git (fetch) upstream https://github.com/jboss-outreach/facebook-echo-bot.git (push)
Remotes are necessary for fetching and pulling files from the main repository .
Starting to work on your fix, you must first create the corresponding Git branch, based on the current code from the base repository.
Choose a clear and concise name for the branch, which would reflect the essence of the changes. It is considered a good practice to include the number of the GitHub issue in the branch name.
$ git fetch upstream # fetches data from the main repository (or upstream) $ git checkout -b <your-name-branch> #Creates a new branch and enables it
Now you can easily start working on the code. While working, keep the following rules in mind:
While you were working on the code, other changes could be made to the main branch of the project. Therefore, before submitting your changes, you need to fetch the new changes and rebase your branch. This is done like this:
$ git checkout <your-name-branch> $ git fetch upstream $ git rebase upstream/master
The next step is to add and then commit your change, this can be done by:
git status # This will list all the edited files git add filename.extension #To add individual files OR git add . # To add all the files at once
git commit -m"Enter your commit message here"
The commit message should be very brief but at the same time informative. Use your words wisely!
$ git push origin <your-name-branch>
After that, we go to your project clone repository, in which you participate and click the button "New Pull Request". And we see the following form:
On the left, you must select the branch in which you want to push the changes (this is usually the master, well, in general, this is the branch you rebase to) and on the right is a branch with your changes.
Next, you will see a message from GitHub whether it is possible to automatically merge the changes or not. In most cases, you will get a success message which says "Able to merge."
If there are conflicts, you will most likely need to review your changes.
Then click on - Create Pull Request. When filling out the name and description of your Pull Request it is considered good practice to specify the Issue number for which your Pull Request is created. After creating the Pull Request, it will run the tests, perhaps some tools for metrics and so on. The results of his work you will see in your Pull Request as shown below:
In case the tests are not passed or the build is not compiled, you will see a red error message and by clicking the Details link you will see what is wrong. In most cases, you will need to fix your Pull Request so that all checks are successful.
If everything is good with your pull request, then soon it will be merged by a project collaborator. However, it is more likely that a reviewer asks for some changes to be made to your pull request. To do so, simply return to step 6 and after making the changes and commit we perform the following commands:
$ git checkout <your-name-branch> $ git fetch upstream $ git rebase upstream/master $ git push origin <your-name-branch>
After your pull request has been accepted or rejected, you need to delete the branch with your changes. This is simply done with:
$ git checkout master $ git branch -D <your-name-branch> $ git push origin --delete <your-name-branch>
Instead of the last command, you can also run
$ git push origin :<your-name-branch>
Keep Contributing to open source! 😄
Dashboard Searchand type