31 lines
789 B
JavaScript
31 lines
789 B
JavaScript
|
module.exports = Self => {
|
||
|
Self.remoteMethodCtx('sendMessage', {
|
||
|
description: 'Send a RocketChat message',
|
||
|
accessType: 'WRITE',
|
||
|
accepts: [{
|
||
|
arg: 'to',
|
||
|
type: 'String',
|
||
|
required: true,
|
||
|
description: 'user (@) or channel (#) to send the message'
|
||
|
}, {
|
||
|
arg: 'message',
|
||
|
type: 'String',
|
||
|
required: true,
|
||
|
description: 'The message'
|
||
|
}],
|
||
|
returns: {
|
||
|
type: 'Object',
|
||
|
root: true
|
||
|
},
|
||
|
http: {
|
||
|
path: `/sendMessage`,
|
||
|
verb: 'POST'
|
||
|
}
|
||
|
});
|
||
|
|
||
|
// FIXME: Deprecate this method #2019
|
||
|
Self.sendMessage = async(ctx, to, message) => {
|
||
|
return Self.send(ctx, to, message);
|
||
|
};
|
||
|
};
|