--- title: "Dynamic Campaign" slug: "server-api-livechat-dynamic-campaign" updated: 2022-07-25T08:09:00Z published: 2022-07-25T08:09:00Z canonical: "developer.comm100.com/server-api-livechat-dynamic-campaign" --- > ## Documentation Index > Fetch the complete documentation index at: https://developer.comm100.com/llms.txt > Use this file to discover all available pages before exploring further. # Dynamic Campaign ## Dynamic Campaign - `Dynamic Campaigns` - Dynamic Campaigns Manage - `GET livechat/dynamicCampaignConfig` - [Get a single Dynamic Campaign](/docs/server-api-livechat-dynamic-campaign#get-a-single-dynamic-campaign) - `PUT livechat/dynamicCampaignConfig` - [Update the Dynamic Campaign](/docs/server-api-livechat-dynamic-campaign#update-the-dynamic-campaign) - `Dynamic Campaign Rules` - Dynamic Campaign Rules Manage - `GET livechat/dynamicCampaignRules` - [Get the list of Dynamic Campaign Rules](/docs/server-api-livechat-dynamic-campaign#get-the-list-of-dynamic-campaign-rules) - `GET livechat/dynamicCampaignRules/{id}` - [Get a single Dynamic Campaign Rule](/docs/server-api-livechat-dynamic-campaign#get-a-single-dynamic-campaign-rule) - `POST livechat/dynamicCampaignRules` - [Create a new Dynamic Campaign Rule](/docs/server-api-livechat-dynamic-campaign#create-a-new-dynamic-campaign-rule) - `POST livechat/dynamicCampaignRules/{id}:disable` - [Disable the Dynamic Campaign Rule](/docs/server-api-livechat-dynamic-campaign#disable-the-dynamic-campaign-rule) - `POST livechat/dynamicCampaignRules/{id}:enable` - [Enable the Dynamic Campaign Rule](/docs/server-api-livechat-dynamic-campaign#enable-the-dynamic-campaign-rule) - `PUT livechat/dynamicCampaignRules/{id}` - [Update the Dynamic Campaign Rule](/docs/server-api-livechat-dynamic-campaign#update-the-dynamic-campaign-rule) - `DELETE livechat/dynamicCampaignRules/{id}` - [Remove the Dynamic Campaign Rule](/docs/server-api-livechat-dynamic-campaign#remove-the-dynamic-campaign-rule) ### 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[]](/docs/server-api-livechat-dynamic-campaign#dynamic-campaign-rule-json-format) | 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 \| | | 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 | | ### Get a single Dynamic Campaign `GET livechat/dynamicCampaignConfig` - #### Parameters: No Parameters - #### Response: [Dynamic Campaign](/docs/server-api-livechat-dynamic-campaign#dynamic-campaign-json-format) - #### 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?
\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: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `defaultCampaignId` | guid | body | yes | Id of the default campaign. | | `dynamicCampaignRules` | [dynamicCampaignRules[]](/docs/server-api-livechat-dynamic-campaign#dynamic-campaign-rule-json-format) | body | no | Reference to Dynamic Campaign Rule. | - #### Response: [Dynamic Campaign](/docs/server-api-livechat-dynamic-campaign#dynamic-campaign-json-format) - #### 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: | 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[]](/docs/server-api-livechat-dynamic-campaign#rule-condition-json-format) | Reference to Rule Condition. | ### Get the list of Dynamic Campaign Rules `GET livechat/dynamicCampaignRules` - #### Parameters: No Parameters - #### Response: An array of [Dynamic Campaign Rule](/docs/server-api-livechat-dynamic-campaign#dynamic-campaign-rule-json-format) - #### 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](/docs/server-api-livechat-dynamic-campaign#dynamic-campaign-rule-json-format) - #### 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: | 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 when conditionMetType is logicalExpression | 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[]](/docs/server-api-livechat-dynamic-campaign#rule-condition-json-format) | body | no | Reference to Rule Condition. | - #### Response: [Dynamic Campaign Rule](/docs/server-api-livechat-dynamic-campaign#dynamic-campaign-rule-json-format) - #### 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](/docs/server-api-livechat-dynamic-campaign#dynamic-campaign-rule-json-format) - #### 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](/docs/server-api-livechat-dynamic-campaign#dynamic-campaign-rule-json-format) - #### 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: | 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 when conditionMetType is logicalExpression | 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[]](/docs/server-api-livechat-dynamic-campaign#rule-condition-json-format) | body | no | Reference to Rule Condition. | - #### Response: [Dynamic Campaign Rule](/docs/server-api-livechat-dynamic-campaign#dynamic-campaign-rule-json-format) - #### 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