Creating a chatbot web service

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:

  1. 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>
  1. Implement ...

Get Hands-On Chatbots and Conversational UI Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.