The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Rocket.Chat/app/graphql/server/resolvers/messages/sendMessage.js

27 lines
600 B

import { processWebhookMessage } from '../../../../lib';
import { authenticated } from '../../helpers/authenticated';
import schema from '../../schemas/messages/sendMessage.graphqls';
const resolver = {
Mutation: {
sendMessage: authenticated((root, { channelId, directTo, content }, { user }) => {
const options = {
text: content,
channel: channelId || directTo,
};
const messageReturn = processWebhookMessage(options, user)[0];
if (!messageReturn) {
throw new Error('Unknown error');
}
return messageReturn.message;
}),
},
};
export {
schema,
resolver,
};