Skip to content

Instantly share code, notes, and snippets.

@venetucci
Last active November 25, 2016 07:57
Show Gist options
  • Save venetucci/0be7ba53fcf2ee5b160ff921941aca9c to your computer and use it in GitHub Desktop.
Save venetucci/0be7ba53fcf2ee5b160ff921941aca9c to your computer and use it in GitHub Desktop.
function postTopicNamesResponse(channel, topicNames) {
var payload = {
"channel": "#" + channel,
"username": "Topic List",
"icon_emoji": ":grin:",
"attachments":[
{
"fallback": "This is an update from a Slackbot integrated into your organization. Your client chose not to show the attachment.",
"pretext": "You can use the following topic names: " + topicNames.join(", "),
"mrkdwn_in": ["pretext"]
}
]
};
var url = '[INCOMING WEBHOOK URL]';
var options = {
'method': 'post',
'payload': JSON.stringify(payload)
};
return UrlFetchApp.fetch(url,options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment