最后我一个人写了一段时间
Cloud Functions action that posts statistics
// now compose the payload and post it to Slack
var payload= {
text : resString,
channel : channel,
attachments: [
{
fallback: "Weekly top 25 repositories",
title: "Top 25 repositories by unique views ("+workweek+")",
mrkdwn_in: ["text"],
text : dataString
}
]
};
var options = {
method: 'POST',
uri: webhook,
body: payload,
resolveWithFullResponse: true,
json: true // Automatically stringifies the body to JSON
};
// return response to the request, so the status will be logged
return rp(options).then(function(response) {
return response;
});