@@ -49,6 +49,58 @@ export async function executeAppChat(
4949 }
5050 return undefined ;
5151 } ;
52+ const parseCommaSeparatedList = ( value : string ) : string [ ] => {
53+ if ( ! value . trim ( ) ) {
54+ return [ ] ;
55+ }
56+
57+ return value
58+ . split ( ',' )
59+ . map ( ( item ) => item . trim ( ) )
60+ . filter ( ( item ) => item ) ;
61+ } ;
62+ const normalizeMentionedUsers = ( value : unknown ) : string [ ] => {
63+ if ( Array . isArray ( value ) ) {
64+ return value
65+ . map ( ( item ) => String ( item ) . trim ( ) )
66+ . filter ( ( item ) => item ) ;
67+ }
68+
69+ if ( typeof value === 'string' ) {
70+ const trimmed = value . trim ( ) ;
71+ if ( ! trimmed ) {
72+ return [ ] ;
73+ }
74+
75+ if ( trimmed . startsWith ( '[' ) ) {
76+ try {
77+ const parsed = JSON . parse ( trimmed ) as unknown ;
78+ if ( Array . isArray ( parsed ) ) {
79+ return parsed
80+ . map ( ( item ) => String ( item ) . trim ( ) )
81+ . filter ( ( item ) => item ) ;
82+ }
83+ } catch ( error ) {
84+ void error ;
85+ }
86+ }
87+
88+ if ( trimmed . includes ( ',' ) ) {
89+ return parseCommaSeparatedList ( trimmed ) ;
90+ }
91+
92+ if ( trimmed . includes ( '|' ) ) {
93+ return trimmed
94+ . split ( '|' )
95+ . map ( ( item ) => item . trim ( ) )
96+ . filter ( ( item ) => item ) ;
97+ }
98+
99+ return [ trimmed ] ;
100+ }
101+
102+ return [ ] ;
103+ } ;
52104
53105 for ( let i = 0 ; i < items . length ; i ++ ) {
54106 try {
@@ -162,13 +214,22 @@ export async function executeAppChat(
162214 if ( operation === 'sendText' ) {
163215 const content = this . getNodeParameter ( 'content' , i ) as string ;
164216 const safe = this . getNodeParameter ( 'safe' , i , false ) as boolean ;
217+ const mentionedList = this . getNodeParameter ( 'mentionedList' , i , [ ] ) as
218+ | string
219+ | string [ ] ;
220+ const text : IDataObject = {
221+ content,
222+ } ;
223+ const mentionedUsers = normalizeMentionedUsers ( mentionedList ) ;
224+
225+ if ( mentionedUsers . length > 0 ) {
226+ text . mentioned_list = mentionedUsers ;
227+ }
165228
166229 body = {
167230 ...body ,
168231 msgtype : 'text' ,
169- text : {
170- content,
171- } ,
232+ text,
172233 safe : safe ? 1 : 0 ,
173234 } ;
174235 } else if ( operation === 'sendImage' ) {
0 commit comments