Is there an ejabberd module that sends stanzas using webhooks? - xmpp

I want to make it easy for people to write bots for my ejabberd server by allowing them to register webhooks with their bot JIDs. Basically, I want them to be able to interact with my ejabberd server using HTTP to send and receive XMPP stanzas instead of having to maintain persistent XMPP connections. For example, the bots could simply make HTTP calls to my ejabberd server to send XMPP stanzas, and then the server would send messages to the bots by making HTTP calls to the registered webhooks. This would allow the bots to be simple HTTP servers that could easily scale horizontally.
I did find this module (https://github.com/adnam/ejabberd-webhooks) but it doesn’t seem to do exactly what I want and also it doesn’t seem to be maintained. Is there a well-maintained (maybe official) ejabberd module that does this? Maybe there is an XEP I’m not aware of that ejabberd implements? Are there other XMPP servers that support this? Thank you in advance!

the bots could simply make HTTP calls to my ejabberd server to send XMPP stanzas,
You can do this installing mod_rest in ejabberd:
https://github.com/processone/ejabberd-contrib/tree/master/mod_rest
and then the server would send messages to the bots by making HTTP calls to the registered webhooks.
I am not aware of any simple module to do this. There are Push XEPs, see https://xmpp.org/extensions/xep-0357.html but I think ejabberd Community Server does not implement everything required, only the Business Edition.

Related

Openfire XMPP Bot over Channels

I am using Openfire as an XMPP server for building a customer support Bot framework.
I am planning to make use of channels/groups for the same. I am keen to use channels as there might be multiple human agents and a bot listening to the same conversation. So I am likely to have a group/channel for each individual.
I want the messages to be read and processed by my custom server. How do I go about this ? I couldn't find any plugin that allows me to intercept the messages and return back processed response.
Any recommendations ?
You can also create your an own openfire bot plugin if you are familiar with Java (small example: https://rmsol.de/2018/03/06/Openfire_Bot/). Otherwise create bot as a client lilke dontknow suggested (The "bot/client" will join every channel you like and e.g. listen for specific keywords)
I figured out that since Openfire is an XMPP Communication software, its best to just use a custom XMPP client ( on your own server ) to listen to all the messages and process it from there and reply back from the XMPP Client as well.
So if I have a Nodejs server, I will create a Node XMPP Client and listen to XMPP messages coming via Openfire from other users, will process them and reply back with custom messages which Openfire will send back to the user.

Is it possible to listen/monitor messages send from a user to an another on Openfire Server using Smack API?

is it possible to listen / monitor messages send from a user to an another on Openfire Server using Smack API
No, that would be a privacy violation, because it would mean that a third party is able to intercept and read messages between two JIDs.
Of course, you can modify any XMPP server to relay certain XMPP stanzas to a third party. But since there is no XEP that defines a API for such a mechanism, it's also not available in Smack.

Sharing Jabber chat session between multiple clients

I'm using Jitsi on client side and ejabberd on server.
It seems that the chat sessions are specific to clients, i.e. if I'm logged in to the same account from 2 different clients, there will be 2 separate sessions, and one can't see what's happening in another.
Is it possible to share the sessions for the same account on all clients? Like Skype or GTalk.
If yes, is it a server configuration or client?
Thank you.
I think what you're looking for is XEP-0280 Message Carbons. Basically the server takes care of relaying the chat to all of your online resources so that you have the same chat session across all devices.
You even get chatstates from all of your other resources so you can infer whether or not you should show an unread IM notification to the user on your resource or not. You'll need client and server support for this, and it looks like ejabberd has implemented it via this module.

XMPP Chat States with Pidgin

I am writing a chat support application that connects to an XMPP server using the SASL Anonymous mechanism. When a user opens my website in their browser, using Socket.IO and NodeJS the server will initiate the anonymous connection with my XMPP server.
This is all working fine. I can connect and communicate with the browser, and it is very cool.
The support team connects to the server using Pidgin. I'd like to be able to display to the browser when the support techs are typing in Pidgin. I set up chat state notifications to work with the browser using AJAX and such, however I am having issues with Pidgin/Adium. Everything seems to work perfectly when I connect from iChat. I get 'active' and 'composing' chat states when the tech is typing. For some reason, however, both Pidgin and Adium are not sending these chat states to the browser client. I've made sure that the proper setting is enabled, as the chat states are being sent between two Pidgin users.
I read something about sending a stanza to report which features a client supports, but the Pidgin client never attempts to request this from the browser.
What am I missing here?
EDIT: I guess I should add that the anonymous browser client is initiating the chat with the Pidgin user, which may be part of the problem here.
Does your client implement XEP-0115, and claim support for the http://jabber.org/protocol/chatstates feature, as specified in section 4 of XEP-0085?
Once you implement that, you'll merely need to deal with libpurple's bugginess.

How to send XMPP Message with a given From or ReplyTo?

I would like to initiate a Chat between two users A and B from my web application. So I create an XMPP Message using Smack Client API or directly from an OpenFire Plugin:
Send a Message by Smack from A to B
Send a Message by Smack from Server to B with replyTo A
XEP-0033 allow "replyTo address" supported by OpenFire but not suported by IM Clients.
It seems "from" can't be overrided by a client or an OpenFire plugin. I also think GTalk will not accept an xmpp message from userA#gmail.com to userB#gmail.com by ServerToServer protocol.
Is there an other way to do this ? I want my web application to forge a message from UserA to UserB. But this webapp is not A or B.
Best Regards,
Jp
Any XMPP server should ignore the from address in a stanza and stamp the one that it get's from the connection into the stanza it sends on. This is a specific feature of XMPP compliant servers and is used to stop address spoofing and spam etc. You'd probably have to edit the source of a server and change it's behaviour. This is dangerous though and I wouldn't reccomend it if you'll be federating with other servers.
J