How to use the @atomist/slack-messages.render function in @atomist/slack-messages

To help you get started, we’ve selected a few @atomist/slack-messages examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atomist / automation-client / lib / internal / message / ConsoleMessageClient.ts View on Github external
protected async doSend(msg: any,
                           destinations: Destination | Destination[],
                           options?: MessageOptions) {
        let s = "";

        if (isSlackMessage(msg)) {
            s += `@atomist: ${render(msg, true)}`;
        } else {
            s += `@atomist: ${msg}`;
        }

        logger.info(s);
    }
}
github atomist / automation-client / lib / internal / transport / websocket / WebSocketMessageClient.ts View on Github external
event: isEventIncoming(this.request) ? this.request.extensions.operationName : undefined,
            destinations: responseDestinations,
            id: options.id ? options.id : undefined,
            timestamp: ts,
            ttl: ts && options.ttl ? options.ttl : undefined,
            post_mode: options.post === "update_only" ? "update_only" : (options.post === "always" ? "always" : "ttl"),
        };

        if (destinationIdentifier === "web") {
            return Promise.resolve();
        } else if (destinationIdentifier === "slack") {
            if (isSlackMessage(msg)) {
                const msgClone = _.cloneDeep(msg);
                const actions = mapActions(msgClone);
                response.content_type = MessageMimeTypes.SLACK_JSON;
                response.body = render(msgClone, false);
                response.actions = actions;
            } else if (isFileMessage(msg)) {
                response.content_type = MessageMimeTypes.SLACK_FILE_JSON;
                response.body = JSON.stringify({
                    content: msg.content,
                    filename: msg.fileName,
                    filetype: msg.fileType,
                    title: msg.title,
                    initial_comment: msg.comment,
                });
            } else if (typeof msg === "string") {
                response.content_type = MessageMimeTypes.PLAIN_TEXT;
                response.body = msg;
            } else if (!!options.delete) {
                response.content_type = "application/x-atomist-delete";
                response.body === undefined;