I’m new to Jami and I’m looking forward to moving my home-management bot from Telegram to Jami (to avoid depending on a for profit company). But the only document I can find is a example of a Jami <-> IRC bridge. The Python wrapper seems to be undocumented. And I don’t suppose poking the D-Bus API directly is the best idea ever. Is there a way to build bots? Or is it not possible? Am I missing something?
I managed to build my own API by staring at the DBus introspect result. It’s bare bones but good enough to build a conversational bot. Let me know if I can improve it and/or you find it helpful.
I’ve some questions that I haven’t figure out after playing with the DBus API.
How do I mark messages as shown?
There’s setMessageDisplayed but I don’t know what conversationUri and status mean
How to I get the display name for a user?
I can get display name for local accounts through getAccountDetails. But it doesn’t work for accounts that I am are talking to
How do I block/ban a user from my bot?
And how are messages delivered an synced on Jami? My intuition is that text messages goes through OpenDHT. When I log into my bot account from multiple places. One on my PC and one on my dev machine. Sometimes message seems does not arrive on the dev machine. Am I not waiting long enough or I shouldn’t be logged into the same account on multiple computers?
<method name="setMessageDisplayed" tp:name-for-bindings="setMessageDisplayed">
<tp:added version="8.1.0"/>
<tp:docstring>
<p>Informs that a message have been read</p>
</tp:docstring>
<arg type="s" name="accountId" direction="in">
<tp:docstring>
The account ID
</tp:docstring>
</arg>
<arg type="s" name="conversationUri" direction="in">
<tp:docstring>
A conversation uri (swarm:xxxx or jami:xxxx)
</tp:docstring>
</arg>
<arg type="s" name="messageId" direction="in">
<tp:docstring>
The message ID
</tp:docstring>
</arg>
<arg type="i" name="status" direction="in">
<tp:docstring>
The message status, 3 for displayed
</tp:docstring>
</arg>
<arg type="b" name="success" direction="out">
<tp:docstring>
True if the message status was set, false if account, contact or message is unknown.
</tp:docstring>
</arg>
</method>
How to I get the display name for a user?
When you got a profile for a contact (profileReceived), the profile received is a VCard file with all the infos (avatar, display name, etc) and your bot can store it/manages it
How do I block/ban a user from my bot?
removeContact() there is a ban parameter if you want to ban the user