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

28 lines
600 B

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