Skip to content
Add a recipient to the loop of a scenario

Add a recipient to the loop of a scenario

By Mounir 2 min read

Add a mail to a scenario defined in the MDWorks interface.

array Envoi_Mail_Scenario_API ( login, motdepasse, scenario, email, nom, prenom, p1, p2, p3, p4, p5, p6)

Description

Authenticate on MDWorks with login and password.

Select a campaign managed via the API.

Insert a row (recipient + custom variables if applicable).

Start the countdown for the scenario execution.

Parameters (required)

login: customer ID

motdepasse: the password

scenario: scenario identifier

email: email address

nom, prenom, p1, p2, p3, p4, p5, p6: additional fields available for personalization

Return value

Returns an array containing the error message, or an integer containing the recipient identifier (useful for tracking).

Error messages

No field must be left empty login

No field must be left empty motdepasse

The scenario does not exist or does not belong to you

No field must be left empty email

Authentication error (invalid login / password)

Invalid email address

Email address unsubscribed (present in your blacklist)

Example with NuSOAP

include('nusoap/nusoap.php');

$client = new soapclient('https://www.eml-srv.com/_soap/control.php'); // Remove the 's' from 'https' if CURL is not installed

$parametres = array( 'login'=>'your_login', 'motdepasse'=>'your_password', 'scenario'=>'scenario_identifier', 'email'=>'email_address', 'nom'=>'variable_nom', 'prenom'=>'variable_prenom', 'p1'=>'variable_p1', 'p2'=>'variable_p2', 'p3'=>'variable_p3', 'p4'=>'variable_p4', 'p5'=>'variable_p5', 'p6'=>'variable_p6' );

$variable=$client->call('Envoi_Mail_Scenario_API', $parametres);

// Retrieve the error, if any
if($client->fault) die("Error:Code: {$client->faultcode}
" . "Detail: {$client->faultactor}
" . "Solution: {$client->faultstring}
");

print_r($variable);

Example with PHP5

try { $client = new SoapClient(null, array('location' => "https://www.eml-srv.com/_soap/control.php", 'uri'      => "https://www.eml-srv.com",  'encoding'=>'ISO-8859-1'  ));

$variable = $client->Envoi_Mail_Scenario_API('your_login','your_password','21','test@ediware.net','Bresler','Loïc','var1','var2','var3','var4','var5','var6'); //or //$variable = $client->__soapCall(Envoi_Mail_Scenario_API,$parametres);

print_r($variable); } catch (SoapFault $fault) {
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);

}
Last updated on