sc_call_api($profile, $arr_settings)

Permite utilizar las API integradas con Scriptcase. Actualmente ofrecemos la integración con Mandrill y Amazon SES API.

Esta macro tiene dos parámetros:

Parámetros Descripción
$profile Parámetro requerido. Puede ser vacío '' o contener el nombre de la puerta de enlace configurada en "Herramientas> API".
$arr_settings This parameter is optional, as long as the "profile" is not empty.Cuando el mismo es informado debe contenr un Array con la puerta usada y la API key.

 

Ej.1 - Configuración de parámetros, array con información de la API.

$settings = array( 'settings' => ['gateway' => 'mandrill', 'api_key'=> {api_key}] );

$mandrill = sc_call_api('', $settings);

 

Ej. 2: Envío de correo electrónico usando Mandril.

$txt_no_tags = strip_tags({body});

$arr_merge = array(
                'name'  => '',
                'type'  => 'to',
                'email' => 'example@exemple.com'
            );

$var_config = array( 'settings' => ['gateway' => 'mandrill', 'api_key'=> {api_key}] );

$mandrill = sc_call_api('', $var_config);
$var_msg = array(
              'from_email'                     => {from_email},
              'from_name'                      => {from_name},
               'html'                          => {body},
               'text'                          => $txt_no_tags,
               'to'                            => array($arr_merge),              
               'subject'                       => {subject},
               'important'                     => true,            
               'auto_text'                     => null,
               'auto_html'                     => null,
               'inline_css'                    => null,
               'metadata'                      => array('website' => 'www.scriptcase.net')
   );

$async = false;
$return = $mandrill->messages->send($var_msg, $async);

Ej. 3 - Envío de SMS usando clickatell.

$var_config     = array( 
  'message'     => [
    'to'      => {sms_to},
    'message'     => {sms_txt},
    ],
    'settings'    => [
    'gateway'   => {gateway},
    'auth_token'  => {auth_token},
    ] 
);

sc_send_sms($var_config);

Ej. 4 - Uso de la macro con PayPal

  $arr_settings = [
            'gateway' => 'paypal',
            'environment' => 'sandbox',
            'auth_email' => 'vitorjamil@gmail.com',
            'auth_token' => '72AE21503DDA4840BE1DC7945F6D1CE1'
                 ];
sc_call_api('',$arr_settings);