Author Topic: [SOLVED] Use of MediaEmailCreateNewOutboundEmail  (Read 3566 times)

Offline petitspirou

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
[SOLVED] Use of MediaEmailCreateNewOutboundEmail
« on: March 14, 2017, 09:38:04 AM »
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 = "test@test.com";
IAgent agent = container.Resolve<IAgent>();
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?
« Last Edit: April 06, 2017, 06:13:06 PM by petitspirou »

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Use of MediaEmailCreateNewOutboundEmail
« Reply #1 on: March 14, 2017, 09:43:38 AM »
What about From Address?

Offline petitspirou

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: Use of MediaEmailCreateNewOutboundEmail
« Reply #2 on: March 14, 2017, 10:05:08 AM »
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

Offline petitspirou

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: Use of MediaEmailCreateNewOutboundEmail
« Reply #3 on: March 14, 2017, 02:02:59 PM »
Found

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

Offline petitspirou

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: Use of MediaEmailCreateNewOutboundEmail
« Reply #4 on: March 29, 2017, 01:54:19 PM »
Another question
What parameter control the initial content of an email using MediaEmailCreateNewOutboundEmail?

Offline petitspirou

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: Use of MediaEmailCreateNewOutboundEmail
« Reply #5 on: April 03, 2017, 10:40:02 AM »
any idea?

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

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Use of MediaEmailCreateNewOutboundEmail
« Reply #6 on: April 03, 2017, 12:20:30 PM »
What is initial content?

Enviado de meu E6633 usando Tapatalk


Offline petitspirou

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: Use of MediaEmailCreateNewOutboundEmail
« Reply #7 on: April 04, 2017, 09:22:40 AM »
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"

Offline petitspirou

  • Newbie
  • *
  • Posts: 18
  • Karma: 0
Re: Use of MediaEmailCreateNewOutboundEmail
« Reply #8 on: April 06, 2017, 06:12:47 PM »
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"