Conversations Retrieval:
The method
inbox.conversations.get() is used to retrieve conversations involving the bot. It accepts two optional parameters:userJoined(boolean): Indicates whether the bot has interacted with the conversation. If set totrue, only conversations where the bot has interacted will be retrieved. If set tofalse, all conversations involving the bot will be retrieved. Defaults tofalse.
lastId(string): Specifies the last conversation ID fetched. This parameter can be used to fetch conversations after the specified conversation ID. If omitted or set tonull, the method returns the last 10 conversations involving the bot.
// Assuming you have defined the Highrise instance as "bot". bot.on("chatCreate", async (user, message) => { if (message === "conversations") { bot.inbox.conversations.get(false, null).then((conversations) => { console.log(conversations); }).catch(e => console.error(e)); } });
Example Output:
[ { "id": "1_on_1:649d9759cfb5ce5a4ef0d3a6:64b2d35c8893a95b02d668cf", "did_join": true, "unread_count": 0, "last_message": { "message_id": "65e102aab38258ac50bce726", "conversation_id": "1_on_1:649d9759cfb5ce5a4ef0d3a6:64b2d35c8893a95b02d668cf", "createdAt": "2024-02-29T22:18:18", "content": "Hello, world!", "sender_id": "64b2d35c8893a95b02d668cf", "category": "text" }, "muted": false, "member_ids": [ "64b2d35c8893a95b02d668cf", "649d9759cfb5ce5a4ef0d3a6" ], "name": null, "owner_id": null } ]
Go Back: Bot Inbox