Dynamic Campaign

Dynamic Campaigns
- Dynamic Campaigns Manage
GET livechat/dynamicCampaignConfig
PUT livechat/dynamicCampaignConfig
Dynamic Campaign Rules
- Dynamic Campaign Rules Manage
GET livechat/dynamicCampaignRules
GET livechat/dynamicCampaignRules/{id}
POST livechat/dynamicCampaignRules
POST livechat/dynamicCampaignRules/{id}:disable
POST livechat/dynamicCampaignRules/{id}:enable
PUT livechat/dynamicCampaignRules/{id}
DELETE livechat/dynamicCampaignRules/{id}
Model
Dynamic Campaign JSON Format

Dynamic Campaign is represented as simple flat JSON objects with the following keys:

Name Type Description
defaultCampaignId guid Id of the default campaign.
dynamicCode string The code of this campaign.
dynamicCampaignRules dynamicCampaignRules[] Reference to Dynamic Campaign Rule.

Rule Condition JSON Format:

Name Type Description
id guid Id of the rule condition.
dynamicCampaignRuleId guid Id of the dynamic campaign rule.
operator string Allowed values are "is", "contains", "notContains", "isMoreThan", "isLessThan", "isNot", "isNotLessThan", "isNotMoreThan", "regularExpression", "isOneOf", "isNotIn", "dateNotEqualTo", "before", "after", "dateEqualTo".
value string Value of the rule condition.
order integer Order of the rule condition.
fieldName string Field name of the rule condition.
name operator
{!Visitor.Number of visits} is/isNot/isMoreThan/isLessThan
{!Visitor.Number of chats} is/isNot/isMoreThan/isLessThan
{!Visitor.Current Page URL} is/isNot/contains/notContains/regularExpression
{!Visitor.Referrer URL} is/isNot/contains/notContains/regularExpression
{!Visitor.Landing Page URL} is/isNot/contains/notContains/regularExpression
{!Visitor.Search Engine} is/isNot/contains/notContains/regularExpression
{!Visitor.Search Keywords} is/isNot/contains/notContains/regularExpression
{!Visitor.Country/Region} is/isNot/contains/notContains/regularExpression
{!Visitor.State/Province} is/isNot/contains/notContains/regularExpression
{!Visitor.City} is/isNot/contains/notContains/regularExpression
{!Visitor.Operating System} is/isNot/contains/notContains/regularExpression
{!Visitor.Time Zone} isOneOf/isNotIn
{!Visitor.Language} is/isNot/contains/notContains/regularExpression
{!Visitor.Segmentation} isOneOf/isNotIn
{!Chat.Request Page URL} is/isNot/contains/notContains/regularExpression
{!Custom Variable.Custom Variable Name}
When type is text:is/isNot/contains/notContains/regularExpression

When type is integer or decimal:is/isNot/isMoreThan/isLessThan
description string
Endpoint
Get a single Dynamic Campaign

GET livechat/dynamicCampaignConfig

Parameters:
Name Type In Required Description
include string query no Allowed value is "dynamicCampaignRule".
Response:
Example

Sample Request:

curl https://api15.comm100.io/v4/livechat/dynamicCampaignConfig \
-X 'GET' \
-H 'Authorization: Bearer {access_token}' \

Response:

 HTTP/1.1 200 OK

{"defaultCampaignId":"d5c5e6f5-8167-4406-8d31-e50ef878d926","dynamicCode":"<!--Begin Comm100 Live Chat Code-->\n?<div id=\"comm100-button-dynamic\"></div>\n?<script type=\"text/javascript\" >\n? var Comm100API=Comm100API||{};(function(t){function e(e){var a=document.createElement(\"script\"),c=document.getElementsByTagName(\"script\")[0];a.type=\"text/javascript\",a.async=!0,a.src=e+t.site_id,c.parentNode.insertBefore(a,c)}t.chat_buttons=t.chat_buttons||[],t.chat_buttons.push({div_id:\"comm100-button-dynamic\"}),t.site_id=1000,t.dynamic=true,e(\"https://freevue.comm100dev.io/livechat.ashx?siteId=\"),setTimeout(function(){t.loaded||e(\"https://freevue.comm100dev.io/livechat.ashx?siteId=\")},5e3)})(Comm100API||{})\n?</script>\n?<!--End Comm100 Live Chat Code-->","dynamicCampaignRules":[{"id":"D3AF5329-7C46-EB11-8100-00155D081D0B","name":"Dynamic Campaign Rule","isEnabled":false,"conditionMetType":"all","logicalExpression":"(1 or 2) and (3 or 4)","targetCampaignId":"Default Plan","order":1,"dynamicCampaignRuleConditions":[{"id":"E5AA999A-263E-42E0-BC83-025A0DB9076E","dynamicCampaignRuleId":"8B917411-9887-4CF6-AAEE-94543271BFBA","operator":"is","value":"Windows 8.1","order":1,"fieldName":"{!Visitor.Number of visits}","description":""}]}]}
Update the Dynamic Campaign

PUT livechat/dynamicCampaignConfig

Parameters:
Name Type In Required Description
defaultCampaignId guid body yes Id of the default campaign.
dynamicCampaignRules dynamicCampaignRules[] body no Reference to Dynamic Campaign Rule.
Response:
Example

Sample Request:

curl https://api15.comm100.io/v4/livechat/dynamicCampaignConfig \
-X 'PUT' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-D '{"defaultCampaignId":"d5c5e6f5-8167-4406-8d31-e50ef878d926","dynamicCampaignRules":[{"name":"Dynamic Campaign Rule","isEnabled":false,"conditionMetType":"all","logicalExpression":"(1 or 2) and (3 or 4)","targetCampaignId":"Default Plan","order":1,"dynamicCampaignRuleConditions":[{"operator":"is","value":"Windows 8.1","order":1,"fieldName":"{!Visitor.Number of visits}","description":""}]}]}'

Response:

 HTTP/1.1 200 OK

{"defaultCampaignId":"d5c5e6f5-8167-4406-8d31-e50ef878d926","dynamicCode":"<!--Begin Comm100 Live Chat Code-->\n?<div id=\"comm100-button-dynamic\"></div>\n?<script type=\"text/javascript\" >\n? var Comm100API=Comm100API||{};(function(t){function e(e){var a=document.createElement(\"script\"),c=document.getElementsByTagName(\"script\")[0];a.type=\"text/javascript\",a.async=!0,a.src=e+t.site_id,c.parentNode.insertBefore(a,c)}t.chat_buttons=t.chat_buttons||[],t.chat_buttons.push({div_id:\"comm100-button-dynamic\"}),t.site_id=1000,t.dynamic=true,e(\"https://freevue.comm100dev.io/livechat.ashx?siteId=\"),setTimeout(function(){t.loaded||e(\"https://freevue.comm100dev.io/livechat.ashx?siteId=\")},5e3)})(Comm100API||{})\n?</script>\n?<!--End Comm100 Live Chat Code-->","dynamicCampaignRules":[{"id":"D3AF5329-7C46-EB11-8100-00155D081D0B","name":"Dynamic Campaign Rule","isEnabled":false,"conditionMetType":"all","logicalExpression":"(1 or 2) and (3 or 4)","targetCampaignId":"Default Plan","order":1,"dynamicCampaignRuleConditions":[{"id":"E5AA999A-263E-42E0-BC83-025A0DB9076E","dynamicCampaignRuleId":"8B917411-9887-4CF6-AAEE-94543271BFBA","operator":"is","value":"Windows 8.1","order":1,"fieldName":"{!Visitor.Number of visits}","description":""}]}]}
Model
Dynamic Campaign Rule JSON Format

Dynamic Campaign Rule is represented as simple flat JSON objects with the following keys:

Name Type Description
id guid Id of the dynamic campaign rule.
name string Name of the dynamic campaign rule.
isEnabled bool Whether the dynamic campaign rule is enabled or not.
conditionMetType string Allowed values are "all", "any", "logicalExpression".
logicalExpression string Logical expression of the dynamic campaign rule.
targetCampaignId guid Target campaign of the dynamic campaign rule.
order integer Order of the dynamic campaign rule.
dynamicCampaignRuleConditions dynamicCampaignRuleConditions[] Reference to Rule Condition.
Endpoint
Get the list of Dynamic Campaign Rules

GET livechat/dynamicCampaignRules

Parameters:
Name Type In Required Description
include string query no Allowed values are "dynamicCampaignRuleCondition", "targetCampaign".
Response:

An array of   Dynamic Campaign Rule

Example

Sample Request:

curl https://api15.comm100.io/v4/livechat/dynamicCampaignRules \
-X 'GET' \
-H 'Authorization: Bearer {access_token}' \

Response:

 HTTP/1.1 200 OK

[{"id":"D3AF5329-7C46-EB11-8100-00155D081D0B","name":"Dynamic Campaign Rule","isEnabled":false,"conditionMetType":"all","logicalExpression":"(1 or 2) and (3 or 4)","targetCampaignId":"Default Plan","order":1,"dynamicCampaignRuleConditions":[{"id":"E5AA999A-263E-42E0-BC83-025A0DB9076E","dynamicCampaignRuleId":"8B917411-9887-4CF6-AAEE-94543271BFBA","operator":"is","value":"Windows 8.1","order":1,"fieldName":"{!Visitor.Number of visits}","description":""}]}]
Get a single Dynamic Campaign Rule

GET livechat/dynamicCampaignRules/{id}

Parameters:
Name Type In Required Description
include string query no Allowed values are "dynamicCampaignRuleCondition", "targetCampaign".
Response:
Example

Sample Request:

curl https://api15.comm100.io/v4/livechat/dynamicCampaignRules/D3AF5329-7C46-EB11-8100-00155D081D0B \
-X 'GET' \
-H 'Authorization: Bearer {access_token}' \

Response:

 HTTP/1.1 200 OK

{"id":"D3AF5329-7C46-EB11-8100-00155D081D0B","name":"Dynamic Campaign Rule","isEnabled":false,"conditionMetType":"all","logicalExpression":"(1 or 2) and (3 or 4)","targetCampaignId":"Default Plan","order":1,"dynamicCampaignRuleConditions":[{"id":"E5AA999A-263E-42E0-BC83-025A0DB9076E","dynamicCampaignRuleId":"8B917411-9887-4CF6-AAEE-94543271BFBA","operator":"is","value":"Windows 8.1","order":1,"fieldName":"{!Visitor.Number of visits}","description":""}]}
Create a new Dynamic Campaign Rule

POST livechat/dynamicCampaignRules

Parameters:
Name Type In Required Description
name string body yes Name of the dynamic campaign rule.
isEnabled bool body no Whether the dynamic campaign rule is enabled or not.
conditionMetType string body yes Allowed values are "all", "any", "logicalExpression".
logicalExpression string body yes Logical expression of the dynamic campaign rule.
targetCampaignId guid body yes Target campaign of the dynamic campaign rule.
order integer body no Order of the dynamic campaign rule.
dynamicCampaignRuleConditions dynamicCampaignRuleConditions[] body no Reference to Rule Condition.
Response:
Example

Sample Request:

curl https://api15.comm100.io/v4/livechat/dynamicCampaignRules \
-X 'POST' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-D '{"name":"Dynamic Campaign Rule","isEnabled":false,"conditionMetType":"all","logicalExpression":"(1 or 2) and (3 or 4)","targetCampaignId":"Default Plan","order":1,"dynamicCampaignRuleConditions":[{"operator":"is","value":"Windows 8.1","order":1,"fieldName":"{!Visitor.Number of visits}","description":""}]}'

Response:

 HTTP/1.1 201 Created

{"id":"D3AF5329-7C46-EB11-8100-00155D081D0B","name":"Dynamic Campaign Rule","isEnabled":false,"conditionMetType":"all","logicalExpression":"(1 or 2) and (3 or 4)","targetCampaignId":"Default Plan","order":1,"dynamicCampaignRuleConditions":[{"id":"E5AA999A-263E-42E0-BC83-025A0DB9076E","dynamicCampaignRuleId":"8B917411-9887-4CF6-AAEE-94543271BFBA","operator":"is","value":"Windows 8.1","order":1,"fieldName":"{!Visitor.Number of visits}","description":""}]}
Disable the Dynamic Campaign Rule

POST livechat/dynamicCampaignRules/{id}:disable

Parameters:
No Parameters
Response:
Example

Sample Request:

curl https://api15.comm100.io/v4/livechat/dynamicCampaignRules/D3AF5329-7C46-EB11-8100-00155D081D0B:disable \
-X 'POST' \
-H 'Authorization: Bearer {access_token}' \

Response:

 HTTP/1.1 200 OK

{"id":"D3AF5329-7C46-EB11-8100-00155D081D0B","name":"Dynamic Campaign Rule","isEnabled":false,"conditionMetType":"all","logicalExpression":"(1 or 2) and (3 or 4)","targetCampaignId":"Default Plan","order":1,"dynamicCampaignRuleConditions":[{"id":"E5AA999A-263E-42E0-BC83-025A0DB9076E","dynamicCampaignRuleId":"8B917411-9887-4CF6-AAEE-94543271BFBA","operator":"is","value":"Windows 8.1","order":1,"fieldName":"{!Visitor.Number of visits}","description":""}]}
Enable the Dynamic Campaign Rule

POST livechat/dynamicCampaignRules/{id}:enable

Parameters:
No Parameters
Response:
Example

Sample Request:

curl https://api15.comm100.io/v4/livechat/dynamicCampaignRules/D3AF5329-7C46-EB11-8100-00155D081D0B:enable \
-X 'POST' \
-H 'Authorization: Bearer {access_token}' \

Response:

 HTTP/1.1 200 OK

{"id":"D3AF5329-7C46-EB11-8100-00155D081D0B","name":"Dynamic Campaign Rule","isEnabled":true,"conditionMetType":"all","logicalExpression":"(1 or 2) and (3 or 4)","targetCampaignId":"Default Plan","order":1,"dynamicCampaignRuleConditions":[{"id":"E5AA999A-263E-42E0-BC83-025A0DB9076E","dynamicCampaignRuleId":"8B917411-9887-4CF6-AAEE-94543271BFBA","operator":"is","value":"Windows 8.1","order":1,"fieldName":"{!Visitor.Number of visits}","description":""}]}
Update the Dynamic Campaign Rule

PUT livechat/dynamicCampaignRules/{id}

Parameters:
Name Type In Required Description
name string body yes Name of the dynamic campaign rule.
isEnabled bool body no Whether the dynamic campaign rule is enabled or not.
conditionMetType string body yes Allowed values are "all", "any", "logicalExpression".
logicalExpression string body yes Logical expression of the dynamic campaign rule.
targetCampaignId guid body yes Target campaign of the dynamic campaign rule.
order integer body no Order of the dynamic campaign rule.
dynamicCampaignRuleConditions dynamicCampaignRuleConditions[] body no Reference to Rule Condition.
Response:
Example

Sample Request:

curl https://api15.comm100.io/v4/livechat/dynamicCampaignRules/D3AF5329-7C46-EB11-8100-00155D081D0B \
-X 'PUT' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-D '{"name":"Dynamic Campaign Rule","isEnabled":false,"conditionMetType":"all","logicalExpression":"(1 or 2) and (3 or 4)","targetCampaignId":"Default Plan","order":1,"dynamicCampaignRuleConditions":[{"operator":"is","value":"Windows 8.1","order":1,"fieldName":"{!Visitor.Number of visits}","description":""}]}'

Response:

 HTTP/1.1 200 OK

{"id":"D3AF5329-7C46-EB11-8100-00155D081D0B","name":"Dynamic Campaign Rule","isEnabled":false,"conditionMetType":"all","logicalExpression":"(1 or 2) and (3 or 4)","targetCampaignId":"Default Plan","order":1,"dynamicCampaignRuleConditions":[{"id":"E5AA999A-263E-42E0-BC83-025A0DB9076E","dynamicCampaignRuleId":"8B917411-9887-4CF6-AAEE-94543271BFBA","operator":"is","value":"Windows 8.1","order":1,"fieldName":"{!Visitor.Number of visits}","description":""}]}
Remove the Dynamic Campaign Rule

DELETE livechat/dynamicCampaignRules/{id}

Parameters:
No Parameters
Response:

No Content

Example

Sample Request:

curl https://api15.comm100.io/v4/livechat/dynamicCampaignRules/D3AF5329-7C46-EB11-8100-00155D081D0B \
-X 'DELETE' \
-H 'Authorization: Bearer {access_token}' \

Response:

 HTTP/1.1 204 No Content