Set Routing - Early Access

Resource

https://api.infobip.com/ccaas/1/routing

Parameters

Set routing method creates a new routing setup if it does not exists or replaces the existing setup.

As rules inside routing are stored, executed and retrieved in provided order with this method, that order can't be changed.

Every expression within routing can be constructed with at least one or more available operators. Result of expression will be a success (TRUE) only if all results of operations are TRUE. The query will be executed, one expression after another, in the order they are submitted until new inbound message first matches expression. Then the message will be assigned to the matched queue.

Property name Type Description
name string Rule name, light description of expression logic, 255 characters max.
*queueId string Required - Queue ID is a destination queue where the new message will be assigned to.
priority URGENT, HIGH, NORMAL, LOW The priority of the new message. If not provided will be set to default. Default is NORMAL.
enabled boolean Enabled is a boolean value (TRUE, FALSE), so the rule is engaged or avoided in the routing process. If not provided will be set to default. Default is TRUE.
*expression object Required - Querry for logical validation of new messages. See Routing for more info. 4000 characters max.

Request Example

					PUT /ccaas/1/routing HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json

[
    {
        "name": "English Support",
        "queueId": "8772F93BC855D00A1036B771ACA7EC40",
        "priority": "NORMAL",
      	"enabled": true,
        "expression": {
            "$or": [
                {
                    "$eq": {
                        "customer.country": "United Kindom"
                    }
                },
                {
                    "$eq": {
                        "customer.country": "Australia"
                    }
                }
            ]
        }
    },
    {
        "name": "Spanish Support",
        "queueId": "A1C93E138A8D831F49D047BC0A5B1D0D",
        "priority": "NORMAL",
      	"enabled": true,
        "expression": {
            "$in": {
                "customer.country": [
                    "Spain",
                    "Columbia",
                    "Mexico"
                ]
            }
        }
    },
    {
        "name": "Croatian Support",
        "queueId": "04FAFF86C252478D324CF3F980799C9E",
        "priority": "NORMAL",
      	"enabled": true,
        "expression": {
            "$and": [
                {
                    "$starts_with": {
                        "message.customerNumber": "385"
                    }
                },
                {
                    "$neq": {
                        "message.channel": "FACEBOOK_MESSENGER"
                    }
                }
            ]
        }
    },
    {
        "name": "Keyword STOP",
        "queueId": "1E54701F74BD86A070B43DB49478D82C",
        "priority": "NORMAL",
      	"enabled": true,
        "expression": {
            "$starts_with": {
                "message.content": "STOP"
            }
        }
    }
]
					
				

Response

					{
    "statusCode": "SUCCESS",
    "message": "Routing added successfully."
}
					
				
					{
    "statusCode": "ERROR",
    "message": "Required request body is missing or not valid"
}
					
				

Routing order

Order of rules inside routing is essential for proper routing, as rules are matching in provided order. First rule matching message will be used.