Automated engagement - API Documentation

Automated Engagement

Engage users and opportunities using automated engagement rules.

Retrieve an Engagement

GET /v1/{access-token}/engagement
                            
use \FormSynergy\Init as FS;

$api = FS::Api()->Load($profileid);

$api->Get('engagement')
    ->Where([
        'engagementid' => $api->_engagement('engagementid')
    ])
    ->Delete()
    ->As('deleted_engagement');
                            
                            
{
    "engagementid": "engagement-...",
    "profileid": "profile-...",
    "modid": "mod-...",
    "siteid": "web-...",
    "label": "My first engagement",
    "thetrigger": "module",
    "lookup": "module-...",
    "enabled": "yes",
    "triggermodule": "module-...",
    "mainindex": 4,
    "params": [
        {
            "parameters_data": {
                "name": "Input name",
                "operator": "equals_to",
                "comparator": "My value"
            }
        }
    ]
}
                            

Finding Engagements

GET /v1/{access-token}/engagements
                            
use \FormSynergy\Init as FS;

$api = FS::Api()->Load($profileid);
$api->Find('engagements')
    ->Where([
        'label' => 'My first engagement'
    ])
    ->As('engagement', 0);
                            
                            
[{
    "engagementid": "engagement-...",
    "profileid": "profile-...",
    "modid": "mod-...",
    "siteid": "web-...",
    "label": "My first engagement",
    "thetrigger": "module",
    "lookup": "module-...",
    "enabled": "yes",
    "triggermodule": "module-...",
    "mainindex": 4,
    "params": [
        {
            "parameters_data": {
                "name": "Input name",
                "operator": "equals_to",
                "comparator": "My value"
            }
        }
    ]
},
{
    "engagementid": "engagement-...",
    "profileid": "profile-...",
    "modid": "mod-...",
    "siteid": "web-...",
    "label": "My first engagement",
    "thetrigger": "module",
    "lookup": "module-...",
    "enabled": "yes",
    "triggermodule": "module-...",
    "mainindex": 5,
    "params": [
        {
            "parameters_data": {
                "name": "Input name",
                "operator": "equals_to",
                "comparator": "My value"
            }
        }
    ]
}]
                            

Create an Engagement

POST /v1/{access-token}/engagement
                            
use \FormSynergy\Init as FS;

$api = FS::Api()->Load($profileid);

$api->Get('strategy')
    ->Where([
        'siteid' => 'web-...',
        'modid' => 'mod-...'
    ])
    ->As('strategy');
    
$api->Create('engagement')
    ->Attributes([
        'modid' => $api->_strategy('modid'),
        'label' => 'My first engagement',
        'thetrigger' => 'module',
        'lookup' => 'module-...',
        'enabled' => 'yes',
        'siteid' => $api->_strategy('siteid'),
        'triggermodule' => 'module-...',
        'params' => [[
            'parameters_data' => [
                'name' => 'Input name',
                'operator' => 'equals_to',
                'comparator' => 'My value'
            ]
        ]]
    ])
    ->As('engagement');
                            
                            
{
    "engagementid": "engagement-...",
    "profileid": "profile-...",
    "modid": "mod-...",
    "siteid": "web-...",
    "label": "My first engagement",
    "thetrigger": "module",
    "lookup": "module-...",
    "enabled": "yes",
    "triggermodule": "module-...",
    "mainindex": 4,
    "params": [
        {
            "parameters_data": {
                "name": "Input name",
                "operator": "equals_to",
                "comparator": "My value"
            }
        }
    ]
}
                            

Update an Engagement

PUT /v1/{access-token}/engagement
                            
use \FormSynergy\Init as FS;

$api = FS::Api()->Load($profileid);

$api->Find('engagements')
    ->Where([
        'label' => 'My first engagement'
    ])
    ->As('engagement', 0);

$api->Get('engagement')
    ->Where([
        'engagementid' => $api->_engagement('engagementid')
    ])
    ->Update([
        'label' => 'My killer engagement'
    ])
    ->As('updated_strategy');
                            
                            
{
    "engagementid": "engagement-...",
    "profileid": "profile-...",
    "modid": "mod-...",
    "siteid": "web-...",
    "label": "My killer engagement",
    "thetrigger": "module",
    "lookup": "module-...",
    "enabled": "yes",
    "triggermodule": "module-...",
    "mainindex": 4,
    "params": [
        {
            "parameters_data": {
                "name": "Input name",
                "operator": "equals_to",
                "comparator": "My value"
            }
        }
    ]
}
                            

Delete an Engagement

DELETE /v1/{access-token}/engagement
                            
use \FormSynergy\Init as FS;

$api = FS::Api()->Load($profileid);

$api->Find('engagements')
    ->Where([
        'label' => 'My first engagement'
    ])
    ->As('engagement', 0);

$api->Get('engagement')
    ->Where([
        'engagementid' => $api->_engagement('engagementid')
    ])
    ->Delete()
    ->As('deleted_engagement');
                            
                            
{
    "code": 200,
    "messages": [
        "Item removed"
    ],
    "Authenticate": "AccessPoint",
    "AccessPoint": "fcf1a4d51efa6c5a12f3a7d759a189f4",
    "profileid": "profile-...",
    "uri": "\/v1\/fcf1a4d51efa6c5a12f3a7d759a189f4\/engagement"
}