teklynk/owncast_chat_bot

no message in chat

Opened this issue · 1 comments

ElFDA commented

Hello and thank for your work
I'm playing with your bot and it's all perfect except the chat messages not delivered
I created the access token and if I send a test message with curl it works
Added the browser on obs on http://ipoftheserver:8080/bot.html
Renamed and configured config.json and commands.json
If I sent !fart command I can hear the mp3 I added to the media dir, I see the overlay on the OBS overlay but no "ewww" chat messages :(
Where I'm wrong?
Using Owncast 0.1.1

@ElFDA
Sorry. This issue fell off my radar.

I think the issue you are experiencing is due to CORS. The owncast server may need to allow Access-Control-Allow-Headers since the localhost server is trying to send a post request to the owncast server but it gets blocked. The "say" object is the only part that tries to send something to the owncast server which is why everything else works but "say".

If your owncast server is behind a reverse proxy you can try adding Access-Control-Allow-Headers for all outside requests.

NGINX

add_header Access-Control-Allow-Headers "*" always;

APACHE

Access-Control-Allow-Origin:*

Another way around the issue is to host the chat bot files on the owncast server. I believe the latest version of owncast has a public folder for things like this. https://yourowncastserver/public/owncast_bot/bot.html
This will make it so that the requests come from the same domain name and will not have a CORS issue.
More info about adding files to the owncast server:
https://owncast.online/docs/custom-assets/