@@ -122,9 +122,12 @@ public EventRequest(
122122 JsonObject context = thread .get ("context" ).getAsJsonObject ();
123123 if (context != null ) {
124124 AssistantThreadContext threadContext = AssistantThreadContext .builder ()
125- .enterpriseId (context .get ("enterprise_id" ) != null ? context .get ("enterprise_id" ).getAsString () : null )
126- .teamId (context .get ("team_id" ) != null ? context .get ("team_id" ).getAsString () : null )
127- .channelId (context .get ("channel_id" ) != null ? context .get ("channel_id" ).getAsString () : null )
125+ // enterprise_id here can be a null value
126+ // others cannot be null as of Jan 2025, but added the same logic to all for future safety
127+ .enterpriseId (context .get ("enterprise_id" ) != null && !context .get ("enterprise_id" ).isJsonNull () ? context .get ("enterprise_id" ).getAsString () : null )
128+ .teamId (context .get ("team_id" ) != null && !context .get ("team_id" ).isJsonNull () ? context .get ("team_id" ).getAsString () : null )
129+ .channelId (context .get ("channel_id" ) != null && !context .get ("channel_id" ).isJsonNull () ? context .get ("channel_id" ).getAsString () : null )
130+ .threadEntryPoint (context .get ("thread_entry_point" ) != null && !context .get ("thread_entry_point" ).isJsonNull () ? context .get ("thread_entry_point" ).getAsString () : null )
128131 .build ();
129132 this .getContext ().setThreadContext (threadContext );
130133 }
@@ -134,9 +137,12 @@ public EventRequest(
134137 // message events (user replies)
135138 this .getContext ().setAssistantThreadEvent (true );
136139 this .getContext ().setChannelId (event .get ("channel" ).getAsString ());
137- if (event .get ("thread_ts" ) != null ) {
140+ if (event .get ("thread_ts" ) != null
141+ && !event .get ("thread_ts" ).isJsonNull ()) {
138142 this .getContext ().setThreadTs (event .get ("thread_ts" ).getAsString ());
139- } else if (event .get ("message" ) != null && event .get ("message" ).getAsJsonObject ().get ("thread_ts" ) != null ) {
143+ } else if (event .get ("message" ) != null
144+ && event .get ("message" ).getAsJsonObject ().get ("thread_ts" ) != null
145+ && !event .get ("message" ).getAsJsonObject ().get ("thread_ts" ).isJsonNull ()) {
140146 // message_changed
141147 this .getContext ().setThreadTs (event .get ("message" ).getAsJsonObject ().get ("thread_ts" ).getAsString ());
142148 }
0 commit comments