Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USER_JOINED webhooks are fired as NAME_CHANGE with empty type-field #1302

Closed
unclearParadigm opened this issue Aug 12, 2021 · 3 comments
Closed
Labels
3rd party integration Related to APIs for inbound/outbound interfacing with others. chat Issues dealing with the web chat client and server

Comments

@unclearParadigm
Copy link
Contributor

Hello,

while working on #1274 and #1016 and testing the webhooks I noticed that the USER_JOINED webhook is not sent when a user joins the chat. Instead a NAME_CHANGE webhook is fired, with an additional empty string field called type in eventData.

Sample webhook data when a user joins:

{
    "type": "NAME_CHANGE",
    "eventData": {
        "type": "",
        "id": "wAgcTeM7g",
        "timestamp": "2021-08-12T08:19:28.921355401Z",
        "user": {
            "id": "yFgco6M7R",
            "displayName": "laughing-cray",
            "displayColor": 257,
            "createdAt": "2021-08-12T08:19:28.759651178Z",
            "previousNames": ["laughing-cray"]
        }
    }
}

in contrast to a "standard" Name-Change event:

{
    "type": "NAME_CHANGE",
    "eventData": { 
        "type": "NAME_CHANGE",
        "id": "",
        "timestamp": "0001-01-01T00:00:00Z",
        "user": {
             "id":"3GsPoeG7R",
             "displayName":"ruffy",
             "displayColor":210,
             "createdAt":"2021-08-12T08:25:19.7742789Z",
             "previousNames":["youthful-mestorf"]
        },
        "newName":"ruffy"
    }
}

Expectation

I'd exepect the toplevel type to be "USER_JOINED" or at least the inner "type"-field to be "USER_JOINED". Not saying that this is not enough to differentiate between a USER_JOIN and USER_NAMECHANGE event, but I just think the way it is handled right now is not really intuitive for consumers of the Webhooks.

Reproduce

  • podman run --name owncast --network host docker.io/gabekangas/owncast:latest (can use docker instead of podman)
  • connect OBS to tcp/1935 localhost on same machine
  • open up a browser and join the chat (http://localhost:8080/)
  • "User xxx joined the chat" is display in the chat
  • NAME_CHANGE webhook is fired

Affected Version(s)

= 0.0.7 (haven't tested anything below 0.0.7 though)

@gabek gabek added 3rd party integration Related to APIs for inbound/outbound interfacing with others. chat Issues dealing with the web chat client and server labels Aug 12, 2021
@gabek
Copy link
Member

gabek commented Aug 12, 2021

Doh. Stupid typo. Sorry about that.

Fixed.

{"type":"USER_JOINED","eventData":{"type":"","id":"_r9hUR7nR","timestamp":"2021-08-12T13:17:35.130917963-07:00","user":{"id":"X-CKx5G7g","displayName":"gabe","displayColor":30,"createdAt":"2021-08-04T17:06:17.467669458-07:00","previousNames":["embed-test","gabe"],"nameChangedAt":"2021-08-05T21:32:02.794663883-07:00"}}}

@gabek gabek closed this as completed in b966d32 Aug 12, 2021
@gabek
Copy link
Member

gabek commented Aug 12, 2021

Filed #1305 to clean up these events, as the nested type is unnecessary and confusing. Also the missing IDs are bad.

@unclearParadigm
Copy link
Contributor Author

Oi, awesome! Thanks a lot for the quick fix.

@gabek gabek added this to the v0.0.9 - Bug fix release milestone Aug 13, 2021
xarantolus pushed a commit to xarantolus/owncast that referenced this issue Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party integration Related to APIs for inbound/outbound interfacing with others. chat Issues dealing with the web chat client and server
Projects
None yet
Development

No branches or pull requests

2 participants