I have searched around and couldn’t find any kind of Facebook API for use with Java. Do any of you guys know how to do this?
Question posted in Facebook API
The official documentation for the Facebook APIs can be found here.
The official documentation for the Facebook APIs can be found here.
2
Answers
Their official API/SDK documentation lists multiple 3rd party java sdks. https://developers.facebook.com/docs/apis-and-sdks
You can use this library to connect with Facebook messenger
https://github.com/BotMill/fb-botmill
Steps:
Add dependency to pom file
Then add following mapping to your web.xml
Create botmill.properties file in your classpath and add the your tokens.
the create a FbBotConfiguration below and put all your initial configuration (one time config) on the constructor. This will also initialize the fb authentication.
Then create the following class to add responses.
Configure Facebook App
Use ‘Page Access Token’ as and use a randomly generated string as ‘Verify Token’ in botmill.properties file
Callback URL: .herokuapp.com/callback, e.g.
demo-heroku-app.herokuapp.com/callback
messaging_postbacks, messaging_optins, message_deliveries,
message_reads, messaging_account_linking, message_echoes
webhook to the page events, e.g. Demo
Test your new Chatbot
Demo