Created
March 5, 2016 18:21
-
-
Save markeverard/7aca9f8d3569f7ccb296 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using EPiServer; | |
using EPiServer.Core; | |
using EPiServer.Framework; | |
using EPiServer.Framework.Initialization; | |
using EPiServer.ServiceLocation; | |
namespace Scenarios.Business.Initializations | |
{ | |
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))] | |
public class MakerChannelHookInitialisation : IInitializableModule | |
{ | |
public void Initialize(InitializationEngine context) | |
{ | |
var events = ServiceLocator.Current.GetInstance<IContentEvents>(); | |
events.PublishedContent += PublishedContent; | |
} | |
public void Preload(string[] parameters) | |
{ | |
} | |
public void Uninitialize(InitializationEngine context) | |
{ | |
} | |
private void PublishedContent(object sender, ContentEventArgs e) | |
{ | |
var webhookSender = new MakerChannelWebHookSender(); | |
var content = e.Content; | |
if (content == null) | |
return; | |
var pageContent = content as PageData; | |
if (pageContent == null) | |
return; | |
var value1 = pageContent.Name; | |
var value2 = pageContent.StaticLinkURL; | |
var value3 = pageContent.StartPublish.ToString(); | |
var eventName = "published"; | |
webhookSender.Send(eventName, value1, value2, value3); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment