Dynamic Campaign
  • 25 Jul 2022
  • 6 Minutes to read
  • Dark
    Light

Dynamic Campaign

  • Dark
    Light

Article Summary

Dynamic Campaign

Dynamic Campaign JSON Format

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

NameTypeDescription
defaultCampaignIdguidId of the default campaign.
dynamicCodestringThe code of this campaign.
dynamicCampaignRulesdynamicCampaignRules[]Reference to Dynamic Campaign Rule.

Rule Condition JSON Format:

NameTypeDescription
idguidId of the rule condition.
dynamicCampaignRuleIdguidId of the dynamic campaign rule.
operatorstringAllowed values are "is", "contains", "notContains", "isMoreThan", "isLessThan", "isNot", "isNotLessThan", "isNotMoreThan", "regularExpression", "isOneOf", "isNotIn", "dateNotEqualTo", "before", "after", "dateEqualTo".
valuestringValue of the rule condition.
orderintegerOrder of the rule condition.
fieldNamestringField name of the rule condition.
nameoperator
{!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
descriptionstring

Get a single Dynamic Campaign

GET livechat/dynamicCampaignConfig

  • Parameters:

No Parameters

  • Response:

Dynamic Campaign

  • Example

Sample Request:

curl https://api11.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": "\n?<div></div>\n?\n?",
  "dynamicCampaignRules": [
      {
          "id": "D3AF5329-7C46-EB11-8100-00155D081D0B",
          "name": "Dynamic Campaign Rule",
          "isEnabled": false,
          "conditionMetType": "all",
          "logicalExpression": "(1 or 2) and (3 or 4)",
          "targetCampaignId": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
          "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": ""
              }
          ],
          "targetCampaign": {
              "id": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
              "name": "test",
              "description": "",
              "language": "english"
          }
      }
  ]
} 

Update the Dynamic Campaign

PUT livechat/dynamicCampaignConfig

  • Parameters:

NameTypeinRequiredDescription
defaultCampaignIdguidbodyyesId of the default campaign.
dynamicCampaignRulesdynamicCampaignRules[]bodynoReference to Dynamic Campaign Rule.
  • Response:

Dynamic Campaign

  • Example

Sample Request:

curl https://api11.comm100.io/v4/livechat/dynamicCampaignConfig \ 
    -X 'PUT' \ 
    -H 'Authorization: Bearer {access_token}' \ 
    -H 'Content-Type: application/json' \ 
    -D '{"defaultCampaignId": "9b572219-890d-4ebc-892b-cb89b7ea3e5f","dynamicCampaignRules": [{"name": "Dynamic Campaign Rule","isEnabled": false,"conditionMetType": "all","logicalExpression": "(1 or 2) and (3 or 4)","targetCampaignId": "9b572219-890d-4ebc-892b-cb89b7ea3e5f","order": 1,"dynamicCampaignRuleConditions": [{"operator": "is","value": "Windows 8.1","order": 1,"fieldName": "{!Visitor.Number of visits}","description": ""}],"targetCampaign": {"id": "9b572219-890d-4ebc-892b-cb89b7ea3e5f","name": "test","description": "test","language": "english"}}]}' 

Response:

HTTP/1.1 200 OK

{
  "defaultCampaignId": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
  "dynamicCode": "",
  "dynamicCampaignRules": [
      {
          "id": "66693949-ef5a-41dc-be7f-8e56ca4d6199",
          "name": "Dynamic Campaign Rule",
          "isEnabled": false,
          "conditionMetType": "all",
          "logicalExpression": "",
          "targetCampaignId": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
          "order": 1,
          "dynamicCampaignRuleConditions": [
              {
                  "id": "6ad595c0-eaa0-4817-bb54-92e45970b561",
                  "dynamicCampaignRuleId": "66693949-ef5a-41dc-be7f-8e56ca4d6199",
                  "fieldName": "{!Visitor.Number of visits}",
                  "operator": "is",
                  "value": "Windows 8.1",
                  "order": 1,
                  "description": ""
              }
          ],
          "targetCampaign": {
              "id": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
              "name": "jacktest",
              "description": "",
              "language": "english"
          }
      }
  ]
}

Dynamic Campaign Rule JSON Format

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

NameTypeDescription
idguidId of the dynamic campaign rule.
namestringName of the dynamic campaign rule.
isEnabledboolWhether the dynamic campaign rule is enabled or not.
conditionMetTypestringAllowed values are "all", "any", "logicalExpression".
logicalExpressionstringLogical expression of the dynamic campaign rule.
targetCampaignIdguidTarget campaign of the dynamic campaign rule.
orderintegerOrder of the dynamic campaign rule.
dynamicCampaignRuleConditionsdynamicCampaignRuleConditions[]Reference to Rule Condition.

Get the list of Dynamic Campaign Rules

GET livechat/dynamicCampaignRules

  • Parameters:

No Parameters

  • Response:

An array of Dynamic Campaign Rule

  • Example

Sample Request:

curl https://api11.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": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
      "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": ""
          }
      ],
  "targetCampaign": {
      "id": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
      "name": "test",
      "description": "",
      "language": "english"
  }
  }
] 

Get a single Dynamic Campaign Rule

GET livechat/dynamicCampaignRules/{id}

  • Parameters:

No Parameters

  • Response:

Dynamic Campaign Rule

  • Example

Sample Request:

curl https://api11.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": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
  "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": ""
      }
  ],
  "targetCampaign": {
      "id": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
      "name": "test",
      "description": "",
      "language": "english"
  }
} 

Create a new Dynamic Campaign Rule

POST livechat/dynamicCampaignRules

  • Parameters:

NameTypeinRequiredDescription
namestringbodyyesName of the dynamic campaign rule.
isEnabledboolbodynoWhether the dynamic campaign rule is enabled or not.
conditionMetTypestringbodyyesAllowed values are "all", "any", "logicalExpression".
logicalExpressionstringbodyyes when conditionMetType is logicalExpressionLogical expression of the dynamic campaign rule.
targetCampaignIdguidbodyyesTarget campaign of the dynamic campaign rule.
orderintegerbodynoOrder of the dynamic campaign rule.
dynamicCampaignRuleConditionsdynamicCampaignRuleConditions[]bodynoReference to Rule Condition.
  • Response:

Dynamic Campaign Rule

  • Example

Sample Request:

curl https://api11.comm100.io/v4/livechat/dynamicCampaignRules \ 
    -X 'POST' \ 
    -H 'Authorization: Bearer {access_token}' \ 
    -H 'Content-Type: application/json' \ 
    -D '{"name":"DynamicCampaignRule","isEnabled":false,"conditionMetType":"all","logicalExpression":"(1or2)and(3or4)","targetCampaignId":"9b572219-890d-4ebc-892b-cb89b7ea3e5f","order":1,"dynamicCampaignRuleConditions":[{"operator":"is","value":"Windows8.1","order":1,"fieldName":"{!Visitor.Numberofvisits}","description":""}],"targetCampaign":{"id":"9b572219-890d-4ebc-892b-cb89b7ea3e5f","name":"test","description":"","language":"english"}}'

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": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
  "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": ""
      }
  ],
  "targetCampaign": {
      "id": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
      "name": "test",
      "description": "",
      "language": "english"
  }
} 

Disable the Dynamic Campaign Rule

POST livechat/dynamicCampaignRules/{id}:disable

  • Parameters:

No Parameters

  • Response:

Dynamic Campaign Rule

  • Example

Sample Request:

curl https://api11.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": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
  "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": ""
      }
  ],
  "targetCampaign": {
      "id": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
      "name": "test",
      "description": "",
      "language": "english"
  }
} 

Enable the Dynamic Campaign Rule

POST livechat/dynamicCampaignRules/{id}:enable

  • Parameters:

No Parameters

  • Response:

Dynamic Campaign Rule

  • Example

Sample Request:

curl https://api11.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": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
  "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": ""
      }
  ],
  "targetCampaign": {
      "id": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
      "name": "test",
      "description": "",
      "language": "english"
  }
} 

Update the Dynamic Campaign Rule

PUT livechat/dynamicCampaignRules/{id}

  • Parameters:

NameTypeinRequiredDescription
namestringbodyyesName of the dynamic campaign rule.
isEnabledboolbodynoWhether the dynamic campaign rule is enabled or not.
conditionMetTypestringbodyyesAllowed values are "all", "any", "logicalExpression".
logicalExpressionstringbodyyes when conditionMetType is logicalExpressionLogical expression of the dynamic campaign rule.
targetCampaignIdguidbodyyesTarget campaign of the dynamic campaign rule.
orderintegerbodynoOrder of the dynamic campaign rule.
dynamicCampaignRuleConditionsdynamicCampaignRuleConditions[]bodynoReference to Rule Condition.
  • Response:

Dynamic Campaign Rule

  • Example

Sample Request:

curl https://api11.comm100.io/v4/livechat/dynamicCampaignRules/D3AF5329-7C46-EB11-8100-00155D081D0B \ 
    -X 'PUT' \ 
    -H 'Authorization: Bearer {access_token}' \ 
    -H 'Content-Type: application/json' \ 
    -D '{"name":"DynamicCampaignRule","isEnabled":false,"conditionMetType":"all","logicalExpression":"(1or2)and(3or4)","targetCampaignId":"9b572219-890d-4ebc-892b-cb89b7ea3e5f","order":1,"dynamicCampaignRuleConditions":[{"operator":"is","value":"Windows8.1","order":1,"fieldName":"{!Visitor.Numberofvisits}","description":""}],"targetCampaign":{"id":"9b572219-890d-4ebc-892b-cb89b7ea3e5f","name":"test","description":"","language":"english"}}' 

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": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
  "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": ""
      }
  ],
  "targetCampaign": {
      "id": "9b572219-890d-4ebc-892b-cb89b7ea3e5f",
      "name": "test",
      "description": "",
      "language": "english"
  }
} 

Remove the Dynamic Campaign Rule

DELETE livechat/dynamicCampaignRules/{id}

  • Parameters:

No Parameters

  • Response:

No Content

  • Example

Sample Request:

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

Response:

HTTP/1.1 204 No Content


Was this article helpful?

What's Next