PureEngage On-Premises

 View Only

Sign Up

  • 1.  Start email interaction in IWS from 3rd party application

    Posted 12-08-2014 15:07
    We like to start email interactions in IWS directly from our CRM system. We already have an .NET extension in place which we like to extend for this. We tried to create a new mail using the Platform SDK with RequestSubmit, RequestInsertInteraction... but this directly sends the email to the Outbound queue instead of showing the window to the agent.

    Creating a new email window was possible using the RoutingBasedManager and a RequestToDo for a CreateNewOutboundEmail, but there is no solution for inbound emails just yet.

    What is the recommended way of doing this so the agent gets the interaction window shown like he pressed the new mail/reply mail button in IWS itself?


  • 2.  RE: Start email interaction in IWS from 3rd party application

    Posted 12-23-2014 22:01
    Hi Urs,

    I would suggest manually running the CommandChain in IWS to do this for you.  When you execute this command chain based on whatever action (like a button click, receiving an event, whatever), it should create an IWS outbound email interaction.

    The Command Chain is called MediaEmailCreateNewOutboundEmail, you can read more about it here: http://docs.genesys.com/Documentation/IW/8.1.4/Developer/PlaceandMedia
     


  • 3.  RE: Start email interaction in IWS from 3rd party application

    Posted 01-05-2015 12:36
    Hi Andrew

    Thanks for your reply. I tried to achieve my goals using the way you described but I failed in doing so. Maybe I'm doing things wrong so that's why I have to ask back a few more things.

    I have created a new custom command just to check if things are invoked (I think it is not necessary at the end, is it?) and added it to the command chain like this:
    commandManager.InsertCommandToChainOfCommandBefore("MediaEmailCreateNewOutboundEmail", "Create", new List<CommandActivator>()
    {
        new CommandActivator() { CommandType = typeof(BeforeOutgoingMailCommand), Name = "BeforeOutgoingMail" }
    });
    When I invoke the command chain named MediaEmailCreateNewOutboundEmail, the command is called, but no outgoing mail window is shown then. I tried to provide the necessary parameters but maybe there is my mistake somewhere.
    string interactionId = "Id000"; // This parameter is provided later through the external interface
    string email = "test@email.com"; // This parameter should come from the contact in UCS with contactId provided later through the external interface
    
    ICommandManager commandManager = Container.Resolve<ICommandManager>();
    IMediaOpenMedia mediaOpenMedia = Container.Resolve<IMediaOpenMedia>(); // What needs to be set here as the object seems to be new?
    
    IDictionary<string, object> parameters = new Dictionary<string, object>();
    parameters.Add("CommandParameter", mediaOpenMedia);
    parameters.Add("ParentInteractionId", interactionId);
    parameters.Add("InitialEmail", email);
    
    commandManager.GetChainOfCommandByName("MediaEmailCreateNewOutboundEmail").Execute(parameters);
    What am I doing wrong?


  • 4.  RE: Start email interaction in IWS from 3rd party application

    Posted 01-07-2015 20:07
    Hi Urs,

    I don't think you can get a reference to IMediaOpenMedia the way you have.

    I have also never done this before, but came up with the following below.  I tested and verified this does bring up an IWS related outbound email interaction window.  For me the email address is not carried over and the title bar of the window says "Unidentified", so I speculate the command chain is using UCS to attempt to identify the contact.  

    Let me know if this gets you unstuck and if you make any further progress.  I do have a need to do this as well, but it is lower on my priority list.  Maybe together we can figure this out.
     
    private void btnClick_SendEmail(object sender, RoutedEventArgs e)
            {
                try
                {
                    ICommandManager commandManager = container.Resolve<ICommandManager>();
                    IDictionary<string, object> parameters = new Dictionary<string, object>();
    
                    KeyValueCollection kvc = new KeyValueCollection();
    
                    kvc.Add("To", "some@email.com");
                    IAgent agent = container.Resolve<IAgent>();
    
                    IMediaOpenMedia openMedia = (IMediaOpenMedia)agent.FirstMediaEmail;
                    
                    parameters.Add("UserData", kvc);
                    parameters.Add("CommandParameter", openMedia);
    
                    commandManager.GetChainOfCommandByName("MediaEmailCreateNewOutboundEmail").Execute(parameters);
                }
                catch (Exception)
                {
                }
            }

     


  • 5.  RE: Start email interaction in IWS from 3rd party application

    Posted 01-12-2015 07:06
    Hi Andrew

    Thanks for your reply, but I couldn't get it to work using your code either. There is no exception or other mistake, but there is just no window shown.

    The best I have so far is:
    IDictionary<string, object> parameters = new Dictionary<string, object>();
    parameters.Add("CommandParameter", agent.FirstMediaEmail);
    parameters.Add("TargetId", contactId);
    parameters.Add("OwnerId", "from@email.com");
    parameters.Add("Destination", "some@email.com");
    parameters.Add("RecentIndex", contactId);
    bool todo = routingManager.RequestToDo("CreateNewOutboundEmail", RoutingBasedTarget.Contact, parameters);
    if (todo && parameters.ContainsKey("RoutingBaseCommand"))
    {
        IChainOfCommand chainOfCommand = parameters["RoutingBaseCommand"] as IChainOfCommand;
        if (chainOfCommand != null)
        {
            chainOfCommand.Execute(parameters["RoutingBaseCommandParameters"]);
        }
    }
    But this just works for new emails but not reply emails.


  • 6.  RE: Start email interaction in IWS from 3rd party application

    Posted 01-13-2015 16:35
    Hi Urs,

    At this point I might open a case with support and see what they have to say.  Very strange, I was able to get new email windows to appear with my code.  I believe I was using IWS 8.1.401.50 during my test.

    Regards,
    Andrew