2018-09-15 20:23:05 +00:00
|
|
|
import * as plugins from './slack.plugins';
|
|
|
|
import { IMessageOptions } from './slack.classes.slackmessage';
|
|
|
|
|
|
|
|
export class Slackme {
|
|
|
|
private baseUrl = 'https://hooks.slack.com/services/';
|
|
|
|
private postRoute: string;
|
|
|
|
constructor(postRouteArg: string) {
|
|
|
|
this.postRoute = postRouteArg;
|
|
|
|
}
|
|
|
|
|
|
|
|
sendMessage(messageOptionsArg: IMessageOptions, channelArg: string = 'general') {
|
2018-10-07 20:29:14 +00:00
|
|
|
plugins.smartrequest.postJson(`${this.baseUrl}${this.postRoute}`, {
|
2018-09-15 20:23:05 +00:00
|
|
|
requestBody: {
|
|
|
|
channel: channelArg,
|
|
|
|
attachments: [messageOptionsArg]
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|