Closed kylemcdonald closed 1 year ago
HI @kylemcdonald .
The excepted behavior is that I should be able to see chat messages from the Python app when I have joined the room from my browser.
Unfortunately, no. Chat in Daily Prebuilt is an out of the box feature that we offer but it’s not meant to be programmatically controlled or interacted with except by end users. For people that require a different experience (for example sending messages from a bot), we recommend one of the following routes:
In both cases you still benefit from having Daily's Prebuilt UI instead of having to build your own which is a significant amount of work.
We should definitely clarify this in the docs to avoid this confusion. But basically app messages are internal messages on your application, and actually our chat is built on top of app messages but we currently do not expose a way to send chat messages.
@kylemcdonald We have talked internally and we will be adding a function to send chat messages to Daily Prebuilt.
Thanks! These hints were enough for me to find a workaround. Now I understand that send_app_message
is a generic message sending system, and the chat is implemented on top of that. So I looked at the messages I was receiving from the chat, and found that I could send messages to the chat by imitating them.
Here's my solution:
client.send_app_message(
{"room": "main-room", "event": "chat-msg", "message": str(i)}
)
In my opinion as a developer, I think either providing a lightweight wrapper for this or updating the documentation would have clarified it for me.
Thanks again.
Thanks! These hints were enough for me to find a workaround. Now I understand that
send_app_message
is a generic message sending system, and the chat is implemented on top of that. So I looked at the messages I was receiving from the chat, and found that I could send messages to the chat by imitating them.Here's my solution:
client.send_app_message( {"room": "main-room", "event": "chat-msg", "message": str(i)} )
Yep, this is it :smiley:. However, since internal things can change it's not something we were announcing/documenting. But we will make it available now so if we change anything internally users should be fine.
daily-python 0.3.0 now includes a send_prebuilt_chat_message
to be able to send chat messages to Daily Prebuilt.
I tried sending and receiving messages using this simple app:
I am able to receive messages, but not send them.
I tried using a meeting token, and I also tried sending messages directly to a participant.
After looking at the Daily JS documentation I thought I might need to do:
client.send_app_message({'message': str(i)})
or evenclient.send_app_message(json.dumps({'message': str(i)}))
. But neither of those worked either.I also checked that using
'*'
instead ofNone
forparticipant
did not fix it.The excepted behavior is that I should be able to see chat messages from the Python app when I have joined the room from my browser.
Please help clarify what I am missing. Thanks!