[SOLVED] Use of MediaEmailCreateNewOutboundEmail

Hello,

I want to create a new outbound email programmatically
The same action that WDE does when a user clic on the ‘mail’ icon after typing an email adress

For a call, I use MediaVoiceMakeCall command and it is working well
For email, I try to use MediaEmailCreateNewOutboundEmail command but I fail to find correct parameters

The following code leads to an error “Invalid adress (NULL)”:

destinataire = “[email removed]”;
IAgent agent = container.Resolve();
IDictionary<string, object> parameters = new Dictionary<string, object>();

parameters.Add(“CommandParameter”, agent.FirstMediaEmail);
parameters.Add(“InitialEmail”, destinataire); commandManager.GetChainOfCommandByName(“MediaEmailCreateNewOutboundEmail”).Execute(parameters);

Can you help me to set the correct parameters?

What about From Address?

1 Like

Normally, it is not mandatory to specify it in the outbound creation, the agent will select it during redaction

The API is really not clear…

Chain MediaEmailCreateNewOutboundEmail
-IsPossibleToCreate
—CommandParameter: IInteractionInboundEmail
-AddSignatureParameters
—CommandParameter: IMediaOpenMedia
-AddResponseSignatureParameters
—SignatureOptionValue: String
—ESDKInboundEmail: Interaction
—ThreadingOpenMedia
—ParentInteractionId: String
-Create
—CommandParameter: IMediaOpenMedia
—ParentInteractionId: String
—InitialEmail: String
—UserData: KeyValueCollection
—Extensions: KeyValueCollection
—SignatureParameters: Dictionary<string, object>
-AddRecentCall
—RecentIndex: ObjectTC

Found

InitialEmail is not the good parameter
I had to add the userdata “To”
Weird API

1 Like

Another question
What parameter control the initial content of an email using MediaEmailCreateNewOutboundEmail?

1 Like

any idea?

It is amazing that the API do not expose such a parameter

1 Like

What is initial content?

Enviado de meu E6633 usando Tapatalk

1 Like

Subject and Body

Here is the scenario:

  • Agent works on his CRM
  • In a use case, he clicks on a “create email” button with parameters (email address, subject, message of the email)
  • WDE must open a new outbound email window with subject and body already initialized
    I tried to fill the param “InitialEmail” but it did nothing

Here is the code of the email creation:

                IAgent agent = container.Resolve<IAgent>();
                IDictionary<string, object> parameters = new Dictionary<string, object>();

                KeyValueCollection kvc = new KeyValueCollection();               
                kvc.Add("To", destinataire);
                kvc.Add("Target", destinataire);
                kvc.Add("Target Type", "TypeDestination");
                parameters.Add("CommandParameter", agent.FirstMediaEmail);
                parameters.Add("UserData", kvc);
                commandManager.GetChainOfCommandByName("MediaEmailCreateNewOutboundEmail").Execute(parameters);

A new outbound email window is created with correct “To”

Found the problem

I use agent signature and this override the email content I give to the MediaEmailCreateNewOutboundEmail command
Apparently, it is a “replace” function and not an “add” one…

keys used are:
“Subject”, “StructuredText” and “FromAddress”