Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
using RestSharp;
void ContentServicePublished(IPublishingStrategy sender, PublishEventArgs<IContent> e)
foreach (var entity in e.PublishedEntities)
var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
var url = umbracoHelper.Url(entity.Id, UrlProviderMode.Relative);
var urls = string.Format("{0} or{0}", url);
var t = "New publish : " + entity.Name + " " + urls;
var hash = "".HashEmailForGravatar();
var client = new RestClient("");
var request = new RestRequest("/chat.postMessage", Method.POST);
request.AddParameter("token", "<top-secret>");
request.AddParameter("channel", "#mychannel");
request.AddParameter("username", "Moriyama Bot");
request.AddParameter("text", t);
request.AddParameter("icon_url", string.Format("{0}", hash));
var response = client.Execute(request);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment