Our next step is to make the chatbot available as a web service. This is so that platforms, such as Facebook Messenger, can access the chatbot without having to actually host them on their own servers. In order to make the chatbot available as a web service, the chatbot code needs to be packaged as a web server and hosted on a cloud platform. We will use the Java Spark library to wrap the chatbot code as a web server and the Heroku cloud platform to host it:
- We need to add the Spark dependency to the POM file:
<!-- https://mvnrepository.com/artifact/com.sparkjava/spark-core --><dependency> <groupId>com.sparkjava</groupId> <artifactId>spark-core</artifactId> <version>2.0.0</version></dependency>
- Implement ...