Open new mail interaction window in Genesys Interaction Workspace

1.6k views Asked by At

I got the task to show the "new outbound mail" dialog in Genesys IWS upon an external event from a webservice. I put my IWS extension in place and it loads and can provide a webservice interface.

My main problem now is that I don't understand how I can open the interactions window from my code. I tried to get an instance of it by using:

IInteractionsWindow interactionsView = Container.Resolve<IInteractionsWindow>();
interactionsView.Create();
interactionsView.ShowView();

This actually works only halfway, as I get a new window, but it's completely empty. Do I need to load every single region on its own? Is there a simpler way to achieve my goals in a fully integrated way?

UPDATE: I have now tried to achieve things using the Platform SDK although I have no idea if this really helps me in showing the "new mail" window to the agent. I tried with the following code:

interactionServerProtocol = new InteractionServerProtocol(new Endpoint(new Uri("tcp://ixnServer:7319")));
interactionServerProtocol.ClientName = "CRMIntegrationModule";
interactionServerProtocol.ClientType = InteractionClient.AgentApplication;

contactServerProtocol = new UniversalContactServerProtocol(new Endpoint(new Uri("tcp://ucsServer:5130")));
contactServerProtocol.ClientName = "CRMIntegrationModule";

interactionServerProtocol.Open();
contactServerProtocol.Open();

RequestSubmit request = RequestSubmit.Create();
request.InteractionType = "Outbound";
request.InteractionSubtype = "OutboundNew";
request.MediaType = "email";
request.Queue = "default";

EventAck response = interactionServerProtocol.Request(request) as EventAck;
if (response != null)
{
    string id = Convert.ToString(response.Extension["InteractionId"]);

    RequestInsertInteraction insertRequest = RequestInsertInteraction.Create();
    insertRequest.InteractionAttributes = new InteractionAttributes
    {
        Id = id,
        MediaTypeId = "email",
        TypeId = "Outbound",
        SubtypeId = "OutboundNew",
        TenantId = 101,
        Status = new NullableStatuses(Statuses.Pending),
        Subject = "Testmail",
        EntityTypeId = new NullableEntityTypes(EntityTypes.EmailOut)
    };
    insertRequest.EntityAttributes = new EmailOutEntityAttributes()
    {
        FromAddress = "[email protected]",
        ToAddresses = "[email protected]",
    };
    insertRequest.InteractionContent = new InteractionContent()
    {
        Text = "This is the e-mail body."
    };
    contactServerProtocol.Send(insertRequest);

    RequestPlaceInQueue queueRequest = RequestPlaceInQueue.Create();
    queueRequest.InteractionId = id;
    queueRequest.Queue = "default";
    interactionServerProtocol.Send(queueRequest);
}

interactionServerProtocol.Close();
contactServerProtocol.Close();

The bad thing is the response from the interaction server which is:

attr_ref_id [int] = 2
attr_error_code [int] = 34
attr_error_desc [str] = "Client is not logged in"

I think this could be related to not being logged in correctly somehow but I have not a single clue how to achieve this. Any help?

UPDATE 2 I could send an e-mail using the Platform SDK, but this is not what I really want. The initial question is still valid, as I just want to invoke the interactions window and that's it. The other stuff is up to the user. Is it possible?

2

There are 2 answers

0
Scoregraphic On BEST ANSWER

I made use of the given command chains:

    public IObjectContainer Container { get; set; }

    public void NewItem(string contactId, string emailAddress)
    {
        IAgent agent = Container.Resolve<IAgent>();
        IRoutingBasedManager routingManager = Container.Resolve<IRoutingBasedManager>();

        IDictionary<string, object> parameters = new Dictionary<string, object>();
        parameters.Add("CommandParameter", agent.FirstMediaEmail);
        parameters.Add("TargetId", contactId);
        parameters.Add("OwnerId", agent.ConfPerson.EmailAddress);
        parameters.Add("Destination", emailAddress);
        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"]);
            }
        }
    }
2
orhun.begendi On

You need to use PlatformSDK. add Genesyslab.platform.webmedia.protocols.dll After that you can use *webmedia.tserver.request, under that tab there is requestWeb or sth.

channelService.RegisterEvents(tServerChannel, new Action<Genesyslab.Enterprise.Model.Channel.IClientChannel>

In your main module(have Initialize method), need to registerevent like that. You can put a button or sth, then you can trigger event or you can use commandchain after logon, is up to you.

Good luck.