Google AppEngine provides very cool features. One of these features is the XMPP API, that allows you to write apps that can interact with users through XMPP clients, e.g. Jabber or GTalk.
Here’s a quick description how to create a chat bot which will help you to work for efficient. I think it has the potential to replace at least some managers.
1. Create a new web application project “de.vogella.gae.java.chatbot”. Rename the generated servlet “ChatbotServlet” and adjust web.xml
2. Open the servlet class and add a new attribute that provides access to the XMPP service
private static final XMPPService xmppService = XMPPServiceFactory.getXMPPService();
3. Add a doPost method which will be called when a new message is received. In this method I will parse the incoming message and generate a reply, in our case a simple echo.
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException {
Message message = xmppService.parseMessage(request);
Message reply = new MessageBuilder()
.withRecipientJids(message.getFromJid())
.withMessageType(MessageType.NORMAL)
.withBody(message.getBody())
.build();
xmppService.sendMessage(reply);
}
Read more: Eclipse Papercuts
Here’s a quick description how to create a chat bot which will help you to work for efficient. I think it has the potential to replace at least some managers.
1. Create a new web application project “de.vogella.gae.java.chatbot”. Rename the generated servlet “ChatbotServlet” and adjust web.xml
2. Open the servlet class and add a new attribute that provides access to the XMPP service
private static final XMPPService xmppService = XMPPServiceFactory.getXMPPService();
3. Add a doPost method which will be called when a new message is received. In this method I will parse the incoming message and generate a reply, in our case a simple echo.
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException {
Message message = xmppService.parseMessage(request);
Message reply = new MessageBuilder()
.withRecipientJids(message.getFromJid())
.withMessageType(MessageType.NORMAL)
.withBody(message.getBody())
.build();
xmppService.sendMessage(reply);
}
Read more: Eclipse Papercuts