Home › Forums › BP Better Messages › API insert message in chat
- This topic has 6 replies, 3 voices, and was last updated 7 months, 3 weeks ago by Maarten.
- October 24, 2021 at 7:42 pm #11841
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.October 24, 2021 at 7:49 pm #11844SupportKeymaster
This is great example how to send messages with function:
Thanks!October 24, 2021 at 7:58 pm #11845
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?
DennisJuly 17, 2022 at 12:57 pm #12879
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);October 9, 2022 at 10:31 am #13051MaartenParticipant
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?
October 9, 2022 at 7:03 pm #13057SupportKeymaster
- This reply was modified 7 months, 3 weeks ago by Maarten. Reason: For clarity
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!October 11, 2022 at 7:17 am #13059MaartenParticipant
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.
- You must be logged in to reply to this topic.