twitchdev / issues

Issue tracker for third party developers.
Apache License 2.0
74 stars 6 forks source link

Fragments is null instead of [] on "channel.chat.notification" #983

Closed BarryCarlyon closed 1 month ago

BarryCarlyon commented 1 month ago

Brief description

For some types of messge message.fragments makes sense to be null For other types where the user didn't leave a message it doesn't as they entered "nothing"

Overnight the behaviour changed to fragments always be null if message.text is "empty string" instead of [] empty array

How to reproduce

Subscribe to channel.chat.notification and wait for data

Expected behavior

If message.text is blank/empty/no user submission message.fragments be [] not null

Also of message types where a text isn't possible maybe should be null or the whole message block null like other keys?

Screenshots

Additional context or questions

Snippet from a submission

as a resub this should be fragments []

"message_id":"291a3e12-0512-473e-a994-b523d4c846f9","source_message_id":null,"message":{"text":"","fragments":null},"notice_type":"resub","sub":null,"resub":{"cumulative_months":121,"duration_months":1,"streak_months":null,"sub_tier":"1000","is_prime":true,"is_gift":false,"gifter_is_anonymous":null,"gifter_user_id":null,

Full payload example

{"metadata":{"message_id":"7sehXTgJ3Nj4AuJE4qoz6sYdqvdddquczf2RTa34Y38=","message_type":"notification","message_timestamp":"2024-08-23T09:43:52.312933887Z","subscription_type":"channel.chat.notification","subscription_version":"1"},"payload":{"subscription":{"id":"7df56112-a357-40b1-9c18-7be73a0514b8","status":"enabled","type":"channel.chat.notification","version":"1","condition":{"broadcaster_user_id":"35884167","user_id":"15185913"},"transport":{"method":"websocket","session_id":"AgoQN2dLDmI2S36Y-pqddGCl9RIGY2VsbC1j"},"created_at":"2024-08-23T09:40:44.225064067Z","cost":0},"event":{"broadcaster_user_id":"35884167","broadcaster_user_login":"sintica","broadcaster_user_name":"Sintica","source_broadcaster_user_id":null,"source_broadcaster_user_login":null,"source_broadcaster_user_name":null,"chatter_user_id":"42079880","chatter_user_login":"mostlikedlper24","chatter_user_name":"MostlikedLPer24","chatter_is_anonymous":false,"color":"#FF0000","badges":[{"set_id":"subscriber","id":"36","info":"39"}],"source_badges":null,"system_message":"MostlikedLPer24 subscribed at Tier 1. They've subscribed for 39 months!","message_id":"00871996-0c8a-4da5-b153-0083f807f66c","source_message_id":null,"message":{"text":"","fragments":null},"notice_type":"resub","sub":null,"resub":{"cumulative_months":39,"duration_months":24,"streak_months":null,"sub_tier":"1000","is_prime":false,"is_gift":false,"gifter_is_anonymous":null,"gifter_user_id":null,"gifter_user_name":null,"gifter_user_login":null},"sub_gift":null,"community_sub_gift":null,"gift_paid_upgrade":null,"prime_paid_upgrade":null,"pay_it_forward":null,"raid":null,"unraid":null,"announcement":null,"bits_badge_tier":null,"charity_donation":null,"shared_chat_sub":null,"shared_chat_resub":null,"shared_chat_sub_gift":null,"shared_chat_community_sub_gift":null,"shared_chat_gift_paid_upgrade":null,"shared_chat_prime_paid_upgrade":null,"shared_chat_pay_it_forward":null,"shared_chat_raid":null,"shared_chat_announcement":null}}}

prettied

{
  "metadata": {
    "message_id": "7sehXTgJ3Nj4AuJE4qoz6sYdqvdddquczf2RTa34Y38=",
    "message_type": "notification",
    "message_timestamp": "2024-08-23T09:43:52.312933887Z",
    "subscription_type": "channel.chat.notification",
    "subscription_version": "1"
  },
  "payload": {
    "subscription": {
      "id": "7df56112-a357-40b1-9c18-7be73a0514b8",
      "status": "enabled",
      "type": "channel.chat.notification",
      "version": "1",
      "condition": {
        "broadcaster_user_id": "35884167",
        "user_id": "15185913"
      },
      "transport": {
        "method": "websocket",
        "session_id": "AgoQN2dLDmI2S36Y-pqddGCl9RIGY2VsbC1j"
      },
      "created_at": "2024-08-23T09:40:44.225064067Z",
      "cost": 0
    },
    "event": {
      "broadcaster_user_id": "35884167",
      "broadcaster_user_login": "sintica",
      "broadcaster_user_name": "Sintica",
      "source_broadcaster_user_id": null,
      "source_broadcaster_user_login": null,
      "source_broadcaster_user_name": null,
      "chatter_user_id": "42079880",
      "chatter_user_login": "mostlikedlper24",
      "chatter_user_name": "MostlikedLPer24",
      "chatter_is_anonymous": false,
      "color": "#FF0000",
      "badges": [
        {
          "set_id": "subscriber",
          "id": "36",
          "info": "39"
        }
      ],
      "source_badges": null,
      "system_message": "MostlikedLPer24 subscribed at Tier 1. They've subscribed for 39 months!",
      "message_id": "00871996-0c8a-4da5-b153-0083f807f66c",
      "source_message_id": null,
      "message": {
        "text": "",
        "fragments": null
      },
      "notice_type": "resub",
      "sub": null,
      "resub": {
        "cumulative_months": 39,
        "duration_months": 24,
        "streak_months": null,
        "sub_tier": "1000",
        "is_prime": false,
        "is_gift": false,
        "gifter_is_anonymous": null,
        "gifter_user_id": null,
        "gifter_user_name": null,
        "gifter_user_login": null
      },
      "sub_gift": null,
      "community_sub_gift": null,
      "gift_paid_upgrade": null,
      "prime_paid_upgrade": null,
      "pay_it_forward": null,
      "raid": null,
      "unraid": null,
      "announcement": null,
      "bits_badge_tier": null,
      "charity_donation": null,
      "shared_chat_sub": null,
      "shared_chat_resub": null,
      "shared_chat_sub_gift": null,
      "shared_chat_community_sub_gift": null,
      "shared_chat_gift_paid_upgrade": null,
      "shared_chat_prime_paid_upgrade": null,
      "shared_chat_pay_it_forward": null,
      "shared_chat_raid": null,
      "shared_chat_announcement": null
    }
  }
}

Here this is a "normal" resub the user just didn't enter a chat message/they left it blank.

Fragments should be [] not null.

jbulava commented 1 month ago

This was an unintentional change that has been reverted.