Pregunta

Is it possible to do some action when a chat request is sent by the user to the bot? I know it gets authorized to communicate with the bot, but I want to store the JID of the user as soon as he adds the bot. Is something like this possible?

¿Fue útil?

Solución

Yes, it is possible.

The XMPP Service in GAE also allows you to enable the xmpp_subscribe inbound service. By enabling that in your appengine-web.xml file, you will be able to get the following notifications at the endpoints given below:

  • POSTs to /_ah/xmpp/subscription/subscribe/ signal that the user wishes to subscribe to the application's presence.
  • POSTs to /_ah/xmpp/subscription/subscribed/ signal that the user has allowed the application to receive its presence.
  • POSTs to /_ah/xmpp/subscription/unsubscribe/ signal that the user is unsubscribing from the application's presence.
  • POSTs to /_ah/xmpp/subscription/unsubscribed/ signal that the user has denied the application's subscription request, or cancelled a previously granted subscription.

I have taken the above points from the official documentation. Please refer to the https://developers.google.com/appengine/docs/java/xmpp/overview#Handling_Subscriptions for more details.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top