خرید بک لینک

Vote count: 0

How can i post a custom JSON Message with formatting & indented using slack webhook? I am using nodejs app

var Slack = require('slack-node');
var JsonMessage = process.argv[2];

webhookUri = "https://hooks.slack.com/services/XXXX/xxxx/xxxxxxxx";

slack = new Slack();
slack.setWebhook(webhookUri);

var textmsg = '```' + JsonMessage + '```';

slack.webhook({
  chael: "#status",
  useame: "Monitor Bot",
  icon_emoji: ":ghost:",
  text: textmsg
}, function(err, response) {
  console.log(response);
});

The above code helps to send the JSON but it is not in formatted one. It comes as a string. I would like to have the JSON indented.

Thank you.

asked 8 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 11 فروردين 1395 ساعت: 19:36

صفحه بندی