Is there a Jami bot API avaliable?

Hi all,

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?

There is indeed several ways to do a bot:

So for now, it’s the supposed way to go.

However there is a third way to do it, introduced in Together and will improve in the next versions. Plugins

Doc (will be updated):

For now, it was mainly for video, but Aline is working on chat bots, that will be available

So yeah, if something is missing in the docs or you need more info, feel free to ping, we will complete

Sorry for bumping thread.

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.

1 Like

Cool and you use swarm APIs :slight_smile:

@sblin Thanks! And thanks for your help earlier.

I’ve some questions that I haven’t figure out after playing with the DBus API.

  1. How do I mark messages as shown?
    • There’s setMessageDisplayed but I don’t know what conversationUri and status mean
  2. 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
  3. 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?

cf ConfigurationManager.xml:

<method name="setMessageDisplayed" tp:name-for-bindings="setMessageDisplayed">
           <tp:added version="8.1.0"/>
             <p>Informs that a message have been read</p>
           <arg type="s" name="accountId" direction="in">
               The account ID
           <arg type="s" name="conversationUri" direction="in">
               A conversation uri (swarm:xxxx or jami:xxxx)
           <arg type="s" name="messageId" direction="in">
               The message ID
           <arg type="i" name="status" direction="in">
               The message status, 3 for displayed
           <arg type="b" name="success" direction="out">
               True if the message status was set, false if account, contact or message is unknown.

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

For the sync, pretty everything is explained here: ; If something is still unclear, feel free to ask