it show “Unexpected token ‘return’ [line 2]”. i think different node input data to code node. Then, convert same name object to output data to AI Agent to process.
Incorrect parentheses: You have a closing parenthesis ) right after !== "undefined" that doesn’t match. Remove it.
Misplaced return: In JavaScript, return must be used inside a function, and it can’t be wrapped in parentheses (). Remove these parentheses from around return { json: {...} }
Comma error in message_id: There’s an extra comma after message_id: in the else part.