1
This project is for:
Although there are many low-code and no-code ways to put a chat-bot together now, for advanced use-cases and situations where you want to integrate with existing systems, Java will be the way to go.
Spring Bot is designed to be an abstraction layer on top of other Java bot libraries. i.e it handles the concerns above, and leaves the connectivity and API logic to lower-level libraries.
This means that you can build bots in Spring Bot that will work concurrently on different chat-platforms.
Currently we have just have bindings for Symphony and Microsoft Teams.
Here is an excerpt from the To-Do Tutorial, with screenshots from Symphony and Microsoft Teams.
Let’s say I have a simple POJO called ToDoItem
(containing fields like Description
, Creator
etc.) and a further POJO called ToDoList
which looks like this.
@Work
public class ToDoList {
private List<ToDoItem> items =
new ArrayList<ToDoItem>();
// setters/getters omitted for brevity
}
We can create a Spring Controller like so:
@Controller
public class ToDoController {
@ChatRequest(value="new",
description = "Create new item list")
public ToDoList init() {
return new ToDoList();
}
This creates a new command for the bot. When I type /help
, the bot responds with…
When I type /new
the bot responds with an empty To-Do list like so.
This is the same code running on Microsoft Teams mobile.
I can put an add button on the To-Do list like this:
@Controller
public class ToDoController {
// Other methods
@ChatButton(value = ToDoList.class,
buttonText = "Add")
@ChatResponseBody(
workMode = WorkMode.EDIT)
public NewItemDetails add(User author) {
NewItemDetails out =
new NewItemDetails();
out.assignTo = author;
return out;
}
}
This button will then appear on my To-Do List.
Pressing that button gives me a form to fill in, containing the NewItemDetails
fields.
This is Microsoft Teams Mobile again.
… and so on. Tutorial continues here.
History
API.methods()
on your @Controllers
to messages sent to the bot.User
, Word
, HashTag
…To see how this toolkit works in action, check out some source code here:
Creates reminders in chat rooms when you start talking about time. Uses Stanford NLP Time package.
Allows you to configure news feeds into chat rooms.
Allows you to poll the members of a room, providing a question and a list of answers to vote on.