[Standards] Commands in the context of a conversation

Stephen Paul Weber singpolyma at singpolyma.net
Tue Mar 15 19:14:37 UTC 2016


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

I have been thinking quite a bit recently about "chat bots" and similar user 
interfaces.

A very simple feature which a chat bot might want, is to present the user 
with a menu of options based on the current context of the conversation.  
For example:

User: Hello, bot!
Bot: Welcome! What can I get you today?
      [Menu of: weather, news]
User: [selects weather]
Bot: It is currently 20´C

This smells quite a bit like XEP-0050 to me.  Perhaps like the following:

<message to="bot" from="user">
	<body>Hello, bot!</body>
</message>

<message to="user" from="bot">
	<body>Welcome! What can I get you today?</body>

	<query xmlns='http://jabber.org/protocol/disco#items' 
	      node='http://jabber.org/protocol/commands'>
		<item jid="bot" node="weather" name="Weather" />
		<item jid="bot" node="news" name="News" />
	</query>
</message>

And then if a command is more complex (collect structured information from 
the user, etc) normal XEP-0050 flows apply.  When all information has been 
collected (which in the above example is right away, just executing the 
command is the total of the command session) a pretty empty response comes 
back in <iq/> followed by the bot behaving in this newly-commanded way 
(probably by sending a message).  Continuing the above example:

<iq type='set' to='bot' from='user'>
	<command xmlns='http://jabber.org/protocol/commands'
	         node='weather' />
</iq>

<iq type='result' to='user' from='bot'>
	<command xmlns='http://jabber.org/protocol/commands'
	         sessionid='uuid'
	         node='weather'
	         status='completed' />
</iq>

<message from="bot" to="user">
	<body>It is currently 20´C</body>
</message>

What do people think about this use of XEP-0050?  Are there other XEP 
I should be looking at also?  Any other work on structured features for 
chatbots in XMPP that I should consider?

Assuming something like the above: would it be worth an informational XEP or 
similar describing this particular use case and considerations that go along 
with it?  Obviously the above stanzas are unlikely to produce the desired UI 
with obivous implementations of XEP-0050 (more likely, the menu 
advertisement, while allowed by the XEP, would be ignored by most clients in 
this context).

- -- 
Stephen Paul Weber, @singpolyma
See <http://singpolyma.net> for how I prefer to be contacted
edition right joseph
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJW6F8dAAoJENEcKRHOUZzezBkQAM+35PMAWYalzlctRZv83Ge6
J1dzFPw7Pu77LlTzNVrzt7zU5o9GIHwE+9NyqMsjAWn5Nd4Dc0OCfiyo0T+jecZ6
V8Tb46yfuYxEnpRchVEqrDqlSPi22NV+3HSYMIBqf2eD3xhx/dYduTxof+kjt19w
TiengKHyyDuYC1OOkjtOim8lg3QbrImxZFOVE1Ip5JUZHEoPxJtCYU2MXGFctusQ
RRhHkZK/AcuDTFC3lXi5/COWXbWavaiTjykr8PzBYaHfOR0d12BGIBo1FIXaYkV/
DmbrBv8hERp8gia+q6gWYIHK2CA6//cQISIujpoWP/2i1tiUe8S31K9gQtHZrVPT
PPUNK/db4wdHAwC02ThpOYLyyrkfdo/M1UOj+hFs72/cqgt+s0+Ivs/MFldr6szX
37Q5bYioFh5OH7I6IlyLkGgTOtCJOBCF8hQLahu729zqd8tIWj4UdpNX/4uRIq3l
1WYEc9qEV9ANKdtlDBZdBi6wpGsLimhktcVAxEEOkG8Y0nQ+ZrjJvQX0jZj7DIJq
slreZfGapWN7GSTmnK0O7hBotuMcfWJsBm2fjE5uVHXmxDOTJWFKZv3F+Uh8Jgik
z+5AVC+AByFKe8qak0WhqJfFEWRwJfxxCI2K3s1L4gB47Eo5CxIIIflhXtIv1wWh
qlWuaaSn2dXneh3W5Sj0
=axS6
-----END PGP SIGNATURE-----


More information about the Standards mailing list