Home Forums BP Better Messages API insert message in chat

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #11841
    dennis
    Participant

    Hi,
    Was wondering if somebody has example of posting message in a specific chat? I like to insert ads now and than to get funding for the websocket license.
    Understand that it should support the buddypress messaging api, anyone got example? preferably in C# but any language will do. Highly appreciated.

    Private Messaging

    #11844
    Support
    Keymaster

    Hi there!

    This is great example how to send messages with function:

    How to add welcome message for new users?

    Thanks!

    #11845
    dennis
    Participant

    Hi,
    Again stunned by your support however how to put this message in a specific chat window? should i use thread id for that or something?

    Regards,
    Dennis

    #12879
    dennis
    Participant

    ok, short update, due to other priorities put this on hold for a while. Via the endpoints from buddypress managed to add ads to the group chats every so many seconds. works great. its still pretty unclear to me what the user_id, thread_id, etc actually mean for better messages, can’t seem to confirm it has something to do with which chatroom, just cant get my finger behind it, can you confirm what the parameters mean in context of better messages?

    Current code works but really rough

    Message p = new Message
    {
    recipients = 1,
    sender_id = item.UserId, //, //1
    Id = 1, // 1, // user id??
    thread_id = 0, //??
    message = HTMLTools.CreateChatImgTag(Media.Url, “”)
    };

    var Chats = await wpclient.CustomRequest.UpdateAsync<Message, dynamic>(“buddypress/v1/messages”, p);

    #13051
    Maarten
    Participant

    I kinda have the same question which isn’t answered yet.

    I want to add a message to a chat room each time a user joins a chat room. To welcome them and invite them to introduce themselves. Is there a function that registers whenever somebody joins a chatroom? And then a way to add a message to that chatroom?

    Thank you!

    • This reply was modified 1 year, 6 months ago by Maarten. Reason: For clarity
    #13057
    Support
    Keymaster

    Hi there!

    I checked and there is no hooks yet which allows to track easily, when the user join or leaves chat room.
    Will add in future versions.

    Thanks!

    #13059
    Maarten
    Participant

    Thanks for checking and letting me know. For my use-case a hook when a user joins a chat room would be super useful.

    I’d be very grateful if this can be added to the plugin. Thank you.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.