private void SendEmailCampaign(string newItemId, Sitecore.XConnect.ContactIdentifier identifier, Guid emailCampaignId) { var secret = Sitecore.Configuration.Settings.GetSetting("TokenSecretKey"); var encrypted = Tokenizer.Tokenizer.Encrypt(newItemId, secret); var url = LinkManager.GetItemUrl(Sitecore.Configuration.Factory.GetDatabase("master").GetItem(Sitecore.Context.Site.StartPath), new ItemUrlBuilderOptions { AlwaysIncludeServerUrl = true }); var messageOpitons = new AutomatedMessage(); //Required Parameters messageOpitons.MessageId = Guid.Parse(Templates.EmailCampaignMessageId); messageOpitons.ContactIdentifier = identifier; //Custom Tokens - Optional var tokens = new Dictionary <string, object> { { "urlwithtoken", $"{url}?t={encrypted}" } }; messageOpitons.CustomTokens = tokens; //Language - Optional messageOpitons.TargetLanguage = "en"; //Send Message ClientApiService.SendAutomatedMessage(messageOpitons); }
private static (AutomatedMessage, FakeClock) GetTestMessage() { var fakeClock = new FakeClock(); var intervalMessage = new AutomatedMessage(new IntervalMessage(_delayInMinutes, "Hello there!"), new List <BufferedMessageSender>(), new Mock <IRepository>().Object, fakeClock); return(intervalMessage, fakeClock); }
private static (AutomatedMessage, FakeClock) GetTestMessage() { var fakeClock = new FakeClock(); var intervalMessage = new AutomatedMessage(new IntervalMessage(_delayInMinutes, "Hello there!"), new List <IChatClient>(), fakeClock); return(intervalMessage, fakeClock); }
protected virtual void SendMail(ContactIdentifier toContact, Dictionary <string, object> customTokens, Guid messageId) { var automatedMessage = new AutomatedMessage(); automatedMessage.ContactIdentifier = toContact; automatedMessage.MessageId = messageId; automatedMessage.CustomTokens = customTokens; automatedMessage.TargetLanguage = Sitecore.Context.Language.Name; SendAutomatedMessage(automatedMessage); }
private void ScheduleAutomatedMessages() { var messages = _repository.List <IntervalMessage>(); foreach (IntervalMessage message in messages) { var action = new AutomatedMessage(message.MessageText, message.DelayInMinutes, _chatClients); _automatedActionSystem.AddAction(action); } }
private void SendAutomatedMessage(AutomatedMessage automatedMessage) { if (clientApiService != null) { clientApiService.SendAutomatedMessage(automatedMessage); } else { var automatedMessageBus = ServiceLocator.ServiceProvider.GetService <IMessageBus <AutomatedMessagesBus> >(); automatedMessageBus.Send(automatedMessage); } }
private void ScheduleAutomatedMessages() { var messages = _repository.List <IntervalMessage>(); // HACK: These need to get wrapped elsewhere... var bufferedSenders = _chatClients.Select(c => new BufferedMessageSender(c)) .ToList(); foreach (IntervalMessage message in messages) { var action = new AutomatedMessage(message, bufferedSenders, _repository); _automatedActionSystem.AddAction(action); } }
private void DisplayMessage(AutomatedMessage message) { foreach (var player in BasePlayer.activePlayerList) { if (player == null) { continue; } // Could add exclusions for oxide groups _plugin.DisplayMessageToUser(player, message.Message); } }