diff --git a/apps/meteor/app/lib/server/functions/processWebhookMessage.ts b/apps/meteor/app/lib/server/functions/processWebhookMessage.ts index bbf61fec6f4b..7529a9cdbaeb 100644 --- a/apps/meteor/app/lib/server/functions/processWebhookMessage.ts +++ b/apps/meteor/app/lib/server/functions/processWebhookMessage.ts @@ -33,6 +33,13 @@ type DefaultValues = { emoji: string; }; +const toArray = (value: string | Array): Array => { + if (typeof value === 'string') { + return [value]; + } + return value; +}; + export const processWebhookMessage = async function ( messageObj: Payload, user: IUser & { username: RequiredField }, @@ -40,7 +47,7 @@ export const processWebhookMessage = async function ( ) { const sentData = []; - const channels: Array = [...new Set(messageObj.channel || messageObj.roomId || defaultValues.channel)]; + const channels: Array = [...new Set(toArray(messageObj.channel || messageObj.roomId || defaultValues.channel))]; for await (const channel of channels) { const channelType = channel[0];