On this page
- In order to use the module call Epsilon Harmony API service.
- Currently there are 3 method's that are available in module. Further support for more API's will be added in future.
- Method 1 (Create a Profile Record)
- Method 2 (Update a Profile Record)
- Method 3 (Delete a Profile Record)
- Method 4 (Retrieve a Profile Record)
- Method 5 (Send a Real Time Message (RTM))
- Logging
Usage of the method's available from the module.
In order to use the module call Epsilon Harmony API service.
<?php
$service = \Drupal::service('epsilon_harmony.api_service');
?>
Currently there are 3 method's that are available in module. Further support for more API's will be added in future.
- Create a Profile Record
- Update a Profile Record
- Delete a Profile Record
- Retrieve a Profile Record
- Send a Real Time Message (RTM)
Method 1 (Create a Profile Record)
To create a record pass the desired attributes in a key=>value pair.
<?php
$service = \Drupal::service('epsilon_harmony.api_service');
$record = [];
$record['CustomerKey'] = "<CustomerKey>";
$record['FirstName'] = "<Firstname>";
$record['LastName'] = "<Lastname>";
$record['PreferredChannel'] = "<PreferredChannel>";
$record['GlobalOptOutFlag'] = "<GlobalOptOutFlag>";
$record['AddressLine1'] = "<AddressLine1>";
...etc
$service->createRecord($record);
?>
Note: In the above request only "CustomerKey" is a mandatory attribute rest can be removed.
Method 2 (Update a Profile Record)
<?php
$service = \Drupal::service('epsilon_harmony.api_service');
$record = [];
$record['CustomerKey'] = "<CustomerKey>";
$record['FirstName'] = "<Firstname>";
$record['LastName'] = "<Lastname>";
$record['PreferredChannel'] = "<PreferredChannel>";
$record['GlobalOptOutFlag'] = "<GlobalOptOutFlag>";
$record['AddressLine1'] = "<AddressLine1>";
...etc
$service->updateRecord($record);
?>
Note: In the above request only "CustomerKey" is a mandatory attribute rest can be removed.
Method 3 (Delete a Profile Record)
<?php
$service = \Drupal::service('epsilon_harmony.api_service');
$service->deleteRecord(<CustomerKey>);
?>
Note: In the above request only "CustomerKey" is a mandatory attribute rest can be removed.
Method 4 (Retrieve a Profile Record)
<?php
$service = \Drupal::service('epsilon_harmony.api_service');
$service->retrieveRecord(<CustomerKey>);
?>
Note: In the above request only "CustomerKey" is a mandatory attribute rest can be removed.
Method 5 (Send a Real Time Message (RTM))
To send an Email via Epsilon Harmony first add the desired message key(received from Epsilon) in admin/config/epsilon_harmony/message_configuration
.
In the above form you can add multiple message ID's and trigger the API by passing their respective message identifiers.
<?php
$service = \Drupal::service('epsilon_harmony.api_service');
$record = [];
$record['subjectOverride'] = "<Override if necessary not a required attribute>";
$record['recipients'][] = array(
"customerKey" => "<CustomerKey>",
"emailAddress" => "<Email ID>",
'attributes' => [
array(
'attributeName' => "FIRST_NAME",
'attributeType' => "String",
'attributeValue' => "<FirstName>",
),
array(
'attributeName' => "LAST_NAME",
'attributeType' => "String",
'attributeValue' => "<LastName>",
)
...etc
]
);
$service->sendMessage("<message-identifier>", $record);
?>
Note: In the above request only "customerKey" and "emailAddress" are mandatory attributes rest can be removed.
Logging
All the API triggers are logged in admin/config/epsilon_harmony/logs
.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion