Retrieve an Objective
GET
/v1/{access-token}/objective
use \FormSynergy\Init as FS;
$api = FS::Api()->Load($profileid);
$api->Get('objective')
->Where([
'obsid' => 'obsid-9c16004e7a76a963ee4eb3147febcf15'
])
->As('GetObjective');
{
"profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
"siteid": "site-9540cd7dfdbfc4756b1d8f21cadb94ea",
"modid": "strategy-214d683d70840ed37e4b5db5e7efb529",
"label": "Contact Us",
"properties": {
"fname": {
"value": "yes"
},
"lname": {
"value": "yes"
},
"email": {
"value": "yes",
"confirmed": "yes"
},
"mobile": {
"value": "yes",
"confirmed": "yes"
}
},
"obsid": "stage-bcc4795c5440a0ce6804a28f431621e0",
"email": null,
"recipient": {
"fname": "Jhon",
"lname": "Smith",
"email": "jsmith@demo......com"
},
"endpoint": {
"url": ""
},
"notificationmethod": "email",
"limittomodule": "module-d1f56a5b9b47a55c70f039d4e6529f6d",
"lastused": "2019-02-27 12:11:00",
"created": "2019-02-27 12:11:00"
}
Finding Objectives
GET
/v1/{access-token}/objectives
use \FormSynergy\Init as FS;
$api = FS::Api()->Load($profileid);
$api->Find('objectives')
->Where([
'modid' => $modid
])
->As('FindObjectives');
[{
"profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
"siteid": "site-9540cd7dfdbfc4756b1d8f21cadb94ea",
"modid": "strategy-214d683d70840ed37e4b5db5e7efb529",
"label": "Contact Us",
"properties": {
"fname": {
"value": "yes"
},
"lname": {
"value": "yes"
},
"email": {
"value": "yes",
"confirmed": "yes"
},
"mobile": {
"value": "yes",
"confirmed": "yes"
}
},
"obsid": "stage-bcc4795c5440a0ce6804a28f431621e0",
"email": null,
"recipient": {
"fname": "Jhon",
"lname": "Smith",
"email": "jsmith@demo......com"
},
"endpoint": {
"url": ""
},
"notificationmethod": "email",
"limittomodule": "module-d1f56a5b9b47a55c70f039d4e6529f6d",
"lastused": "2019-02-27 12:11:00",
"created": "2019-02-27 12:11:00"
},
{
"profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
"siteid": "site-9540cd7dfdbfc4756b1d8f21cadb94ea",
"modid": "strategy-214d683d70840ed37e4b5db5e7efb529",
"label": "Order Form",
"properties": {
"fname": {
"value": "yes"
},
"lname": {
"value": "yes"
},
"email": {
"value": "yes",
"confirmed": "yes"
},
"mobile": {
"value": "yes",
"confirmed": "yes"
},
"product": {
"value": "yes",
"confirmed": "no",
"count": 1
}
},
"obsid": "stage-bcc4795c5440a0ce6804a28f431621e0",
"email": null,
"recipient": {
"fname": "Jhon",
"lname": "Smith",
"email": "jsmith@demo......com"
},
"endpoint": {
"url": ""
},
"notificationmethod": "email",
"limittomodule": "module-d1f56a5b9b47a55c70f039d4e6529f6d",
"lastused": "2019-02-27 12:11:00",
"created": "2019-02-27 12:11:00"
}]
Create an Objective
POST
/v1/{access-token}/objective
use \FormSynergy\Init as FS;
$api = FS::Api()->Load($profileid);
$api->Find('websites')
->Where([
'domain' => 'demo......com'
])
->As('websites', 0);
$api->Find('strategies')
->Where([
'modid' => $api->_website('activestrategy')
])
->As('strategy', 0);
$api->Find('modules')
->Where([
'modid' => $api->_strategy('modid'),
'name' => 'Contact Us'
])
->As('ContactForm', 0);
$api->Create('objective')
->Attributes([
'siteid' => $api->_strategy('siteid'),
'modid' => $api->_strategy('modid'),
'label' => $api->_ContactForm('name'),
'properties' => [
'fname' => [
'value' => 'yes'
],
'lname' => [
'value' => 'yes'
],
'email' => [
'value' => 'yes',
'confirmed' => 'yes'
],
'mobile' => [
'value' => 'yes',
'confirmed' => 'yes'
]
],
'limittomodule' => $api->_ContactForm('moduleid'),
'notificationmethod' => 'email',
'recipient' => [
'fname' => 'Jhon',
'lname' => 'Smith',
'email' => 'jsmith@demo.interactionapi.com',
'format' => 'default'
],
'leadboard' => 'yes',
'endpoint' => [
'url' => '',
]
])
->As('CreateObjective');
{
"profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
"siteid": "site-9540cd7dfdbfc4756b1d8f21cadb94ea",
"modid": "strategy-214d683d70840ed37e4b5db5e7efb529",
"label": "Contact Us",
"properties": {
"fname": {
"value": "yes"
},
"lname": {
"value": "yes"
},
"email": {
"value": "yes",
"confirmed": "yes"
},
"mobile": {
"value": "yes",
"confirmed": "yes"
}
},
"obsid": "stage-bcc4795c5440a0ce6804a28f431621e0",
"email": null,
"recipient": {
"fname": "Jhon",
"lname": "Smith",
"email": "jsmith@demo......com"
},
"endpoint": {
"url": ""
},
"notificationmethod": "email",
"limittomodule": "module-d1f56a5b9b47a55c70f039d4e6529f6d",
"lastused": "2019-02-27 12:11:00",
"created": "2019-02-27 12:11:00"
}
Update Objective Properties
PUT
/v1/{access-token}/objective
use \FormSynergy\Init as FS;
$api = FS::Api()->Load($profileid);
$api->Get('objective')
->Where([
'obsid' => 'obsid-9c16004e7a76a963ee4eb3147febcf15'
])
->Update([
'properties' => [
'email' => [
'value' => 'yes',
'confirmed' => 'no'
]
],
'leadboard' => 'yes',
'notificationmethod' => 'webhook',
'endpoint' => [
'url' => 'https://...'
]
])
->As('UpdateObjective');
{
"profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
"siteid": "site-9540cd7dfdbfc4756b1d8f21cadb94ea",
"modid": "mod-a34c88eebfa6df727961ba198d204104",
"label": "Objectve 1",
"properties": {
"email": {
"value": "yes",
"confirmed": "no"
}
},
"obsid": "obsid-9c16004e7a76a963ee4eb3147febcf15",
"email": "yes",
"recipient": {
"fname": "Jhon",
"lname": "Smith",
"email": "jsmith@demo......com"
},
"endpoint": {
"url": "https:\/\/..."
},
"notificationmethod": "webhook",
"limittomodule": "no",
"lastused": null,
"created": null
}
Replace Objective Properties
PUT
/v1/{access-token}/objective
use \FormSynergy\Init as FS;
$api = FS::Api()->Load($profileid);
$api->Get('objective')
->Where([
'obsid' => 'obsid-9c16004e7a76a963ee4eb3147febcf15'
])
->Replace([
'properties' => [
'email' => [
'value' => 'yes',
'confirmed' => 'no'
]
],
'notificationmethod' => 'webhook',
'endpoint' => [
'url' => 'https://...'
]
])
->As('ReplaceObjective');
{
"profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
"siteid": "site-9540cd7dfdbfc4756b1d8f21cadb94ea",
"modid": "mod-a34c88eebfa6df727961ba198d204104",
"label": "Objectve 1",
"properties": {
"email": {
"value": "yes",
"confirmed": "no"
}
},
"obsid": "obsid-9c16004e7a76a963ee4eb3147febcf15",
"email": "yes",
"recipient": {
"fname": "Jhon",
"lname": "Smith",
"email": "jsmith@demo......com"
},
"endpoint": {
"url": "https:\/\/..."
},
"notificationmethod": "webhook",
"limittomodule": "no",
"lastused": null,
"created": null
}
Delete an Objective
DELETE
/v1/{access-token}/objective
use \FormSynergy\Init as FS;
$api = FS::Api()->Load($profileid);
$api->Get('objective')
->Where([
'obsid' => $obsid,
])->Delete()
->As('DeleteObjective');
{
"code": 200,
"messages": ["Item removed"],
"AccessPoint": "754a3683204940fd0f6ac39b25d127e3",
"profileid": "profile-3be1fa342a520cbdf28aa43ab8edefee",
"uri": "\/v1\/754a3683204940fd0f6ac39b25d127e3\/objective"
}
Attributes
siteid
string
Unique identifier for the objective object.
modid
string
Unique identifier for the strategy object.
properties
object
Contains reference fields
leadboard
string
If set to yes: the objective will be automatically added to the lead board. If no: and the objective was previously added to the leadboard, it will be removed from the lead board
limittomodule
string
Unique identifier (moduleid) for the module object.
notificationmethod
string
How to send the data obtain by an interaction. (email, sms, webhook).
recipient
object
The recipient object contains (fname: First name, lname: Last name, email: Email address, sms: Mobile phone)
recipient.fname
string
The recipient's first name
recipient.lname
string
The recipient's last name
recipient.email
string
The recipient's email address
recipient.sms
string
The recipient's mobile number
recipient.format
string
Will set format preference. Available formats: (default: HTML and text, Text: text only, markdown)
endpoint
object
The endpoint object contains (url: Webhook URL, whkey: Webhook key), the webhook key is generated by the API, this property will be automatically populated once the url is set.