Here’s a code sample demonstrating how to send a XMPP message using the App Engine XMPP service. The text of the message is contained in the string reply_body while the recipient is represented by a JID object named from_jid . Applications can retrieve the recipient’s JID by extracting it from a previous message, presence request, or subscribe request.
//Build a message to reply to the user. MessageBuilder message_builder = new MessageBuilder(); message_builder.withRecipientJids(from_jid); message_builder.withBody(reply_body); Message reply_message = message_builder.build(); //Send the message back to the user. SendResponse response_status = xmpp.sendMessage(reply_message);
Remember to import the XMPP package: