auto-complete-after
Section: cview
Default Value: No default value
Valid Values: long
Changes Take Effect: Immediately
Introduced: 8.5.111.04
Time in seconds to wait to auto-complete the service after its last update if auto-complete-enabled = true. This option value is used if it is not explicitly provided in the Start request by setting the auto_complete_after parameter of the Service Start Event. If you do not provide a value for auto_complete_after in the configuration or in the Start request, then only an explicit API call to complete the service will be able to terminate the service.
auto-complete-enabled
Section: cview
Default Value: false
Valid Values: true, false
Changes Take Effect: Immediately
Introduced: 8.5.111.04
Related Feature: auto-complete
If true, enables the auto-complete feature. If a service or its states or its tasks are not updated within the period specified by the option auto-complete-after, the service (including states and tasks) is terminated.
Composite Start and Bulk Update
- Introduced in: 8.5.110
- Updated in: 8.5.205, 8.5.206
POST /genesys/1/cs/services_composite/start
Description
Provides a single API call to update or create all Service, State, and Task objects in a single REST call. You can use this request to submit the JSON structures for three objects: Service, State, and Task events. If the Service object's customer_id, service_type, and contact_key do not match an active Service, the system will create one using this data, including State andTask data. Else, within the found service, it will search for the active State and Task respectively matching the state_type and the task_type specified in the request and it will create them if they are not found.
As a result, Context Services will reply with the IDs of the found and/or created Service, State, and Task resources, and a flag indicating whether they were created or not.
- Introduced in: 8.5.206
The create_new_services parameter enables you to force the creation of a service record, discarding the previous record if any. See also the Create New Services example below.
Bulk Update
- Introduced in: 8.5.205
To perform a bulk update, use the start query and specify update_extensions=true in the start event. Instead of creating a new object, the operation will update the provided extensions of the given objects. This means that only the specified extensions will be updated. For example, if your service's extensions include the Satisfaction extension, and if you do not provide this extension in the query, the extension will neither be updated nor removed from the service.
Auto-complete and Auto-closed Features
- Introduced in: 8.5.206
To complete conversation during the update operation, add auto_closed=true to the service-level keys in the JSON body. If you wish to complete conversation automatically after some time, you can use auto_complete_after=<period of time in seconds> instead of auto_closed in the service-level keys of the JSON body.
See also the Auto-Complete and Auto-Closed example below.
Operation
POST /genesys/1/cs/services_composite/start | |||
---|---|---|---|
Field Name | Type | Mandatory | Description |
Body Parameters | |||
services | JSON array | yes | JSON array of Composite Start Events. |
create_new_services
|
boolean | false | If true, force the service creation even if a previous record exists. If false (default), Context Services first checks if an active Service record exists and, if so, updates the service instead of creating a new one. |
Composite Start Event
Field | Type | Mandatory | Description |
---|---|---|---|
service | JSON structure | yes | Service Start Event. |
state
|
JSON structure | no if create_new_services=true | State Start Event. If create_new_services=true, this start event is not required. |
task | JSON structure | no | Task Start Event. |
associate_state_task | boolean | no | true to associate the Task with the given State; false by default.
If you set this parameter to true, it is equivalent to providing the State ID in a request to start a Task. |
update_extensions
|
boolean | no | true to update the extensions of any provided service, state, or task object. |
Response
The Context Management Service API answers every request with HTTP codes. The following table shows the correct response for a successful request. See HTTP Response Codes and Errors for further details on the possible codes that this operation can return.
200 OK | |
---|---|
Header | Location: ${base_uri}/services/${service_id}/tasks/${task_id}
or ${base_uri}/services/${service_id}/states/${state_id} (if the task field was not provided in the request) where:
|
Body |
{
service: { "service_id": ${service_id}, "created": "true/false", "updated": "true/false"}
state: { "state_id": ${state_id}, "created": "true/false", "updated": "true/false"}
task: { "task_id": ${task_id}, "created": "true/false", "updated": "true/false"}
} |
Examples
Composite Start Creation
POST /genesys/1/cs/services_composite/start
{
"services" : [
{
"service": {
"interaction_id": "123ABCAADFJ1259ACF",
"application_type": "App_type_1",
"application_id": 40,
"est_duration": 60,
"customer_id":"${customer_id}",
"service_type": "MyService1",
"media_type": "voice",
"resource_id": 1183,
"resource_type": "ResType1",
"RelatedOffersService": [
{
"offer_name": "VIP credit card black ed.",
"type": 9,
"comments": "proposed to all client"
},
{
"offer_name": "3 times payment GOLD",
"type": 4,
"comments": "limited offer"
},
{
"offer_name": "life insurance",
"type": 3,
"comments": "healt check to be done before approval"
}
]
},
"state": {
"interaction_id": "123ABCAADFJ1259ACF",
"application_type": "App_type_1",
"application_id": 40,
"resource_type": "ResType1",
"resource_id": 1183,
"media_type": "voice",
"est_duration": 60,
"state_type": "MyState1",
"FeedbackState": {
"FeedbackType": "survey",
"rating": 7,
"notes": "warm welcome at frontdesk, thanks for the nice trip"
},
"SatisfactionState": [
{
"rating": 2,
"pertinence": 8,
"usefull": true,
"place": "Terranova mexico resort"
},
{
"rating": 8,
"pertinence": 4,
"usefull": false,
"place": "Fancy resort Paris"
}
]
},
"task": {
"interaction_id": "123ABCAADFJ1259ACF",
"application_type": "App_type_1",
"application_id": 40,
"resource_type": "ResType1",
"resource_id": 1183,
"media_type": "voice",
"est_duration": 60,
"task_type": "MyTask1",
"FeedbackTask": {
"FeedbackType": "survey",
"rating": 7,
"notes": "warm welcome at frontdesk, thanks for the nice trip"
},
"SatisfactionTask": [
{
"rating": 2,
"pertinence": 8,
"usefull": true,
"place": "Terranova mexico resort"
},
{
"rating": 8,
"pertinence": 4,
"usefull": false,
"place": "Fancy resort Paris"
}
]
},
"associate_state_task": "true"
}
]
}
Result
HTTP 200 OK
location: /genesys/1/cs/services/111222/tasks/555666
{
services: [
{
service: {
"service_id": 111222,
"created": "false",
"updated": "false",
},
state: {
"state_id": 333444,
"created": "true",
"updated": "false"
},
task: {
"task_id": 555666,
"created": "true",
"updated": "false"
}
}
]
}
Bulk Update
- Introduced in: 8.5.205
POST /genesys/1/cs/services_composite/start
{
"services": [
{
"service": {
"timestamp": "2009-05-12T12:05:12.145Z",
"interaction_id": "123ABCAADFJ1259ACF",
"application_type":400,
"application_id":40,
"est_duration":60,
"contact_key":"42",
"service_type":100,
"media_type": 1,
"resource_id": 5005,
"resource_type": 2,
"disposition": 10,
"coupon": {
"coupon_name": "DISCOUNTCODE15"
},
"satisfaction": {
"score": 85,
"agentID": 2025
}
},
"state": {
"interaction_id":"51",
"application_type":400,
"application_id":40,
"resource_type":200,
"resource_id":20,
"media_type":2,
"est_duration":60,
"state_type":100,
"Feedback": {
"FeedbackType":"survey",
"rating":7,
"notes":"warm welcome at frontdesk, thanks for the nice trip"
}
},
"task": {
"interaction_id":42,
"est_duration":460,
"task_type":462,
"Survey": {
"url":"http://ourServer/storage/userAnswers",
"question1":7,
"question2":true,
"question3":"will be better with cable tv and on-demand video"
}
},
"associate_state_task": "true",
"update_extensions": "true"
}
]
}
Result
HTTP 200 OK
location: /genesys/1/cs/services/111222/tasks/555666
{
services: [
{
service: {"service_id": 111222, "created": "false", "updated": "true" },
state: {"state_id": 333444, "created": "true", "updated": "false" },
task: {"task_id": 555666, "created": "true", "updated": "false" }
}
]
}
Auto-closed and Auto-complete
Operation
POST /genesys/1/cs/services_composite/start
{
"services": [
{
"service": {
"interaction_id": "123ABCAADFJ1259ACF",
"application_type":400,
"application_id":40,
"est_duration":60,
"contact_key":"42",
"service_type":100,
"media_type": 1,
"resource_id": 5005,
"resource_type": 2,
"auto_closed": true,
"disposition": 10,
"coupon": {
"coupon_name": "DISCOUNTCODE15"
},
"satisfaction": {
"score": 85,
"agentID": 2025
}
},
"state": {
"interaction_id":"51",
"application_type":400,
"application_id":40,
"resource_type":200,
"resource_id":20,
"media_type":2,
"est_duration":60,
"state_type":100,
"Feedback": {
"FeedbackType":"survey",
"rating":7,
"notes":"warm welcome at frontdesk, thanks for the nice trip"
}
},
"task": {
"interaction_id":42,
"est_duration":460,
"task_type":462,
"Survey": {
"url":"http://ourServer/storage/userAnswers",
"question1":7,
"question2":true,
"question3":"will be better with cable tv and on-demand video"
}
},
"associate_state_task": "true",
"update_extensions": "true"
},
{
"service": {
"interaction_id": "123ABCAADFJ1259ACF",
"application_type":400,
"application_id":40,
"est_duration":60,
"contact_key":"43",
"service_type":100,
"media_type": 1,
"resource_id": 5005,
"resource_type": 2,
"auto_complete_after": 3600,
"disposition": 10,
"coupon": {
"coupon_name": "DISCOUNTCODE15"
},
"satisfaction": {
"score": 85,
"agentID": 2025
}
},
"state": {
"interaction_id":"51",
"application_type":400,
"application_id":40,
"resource_type":200,
"resource_id":20,
"media_type":2,
"est_duration":60,
"state_type":100,
"Feedback": {
"FeedbackType":"survey",
"rating":7,
"notes":"warm welcome at frontdesk, thanks for the nice trip"
}
},
"task": {
"interaction_id":42,
"est_duration":460,
"task_type":462,
"Survey": {
"url":"http://ourServer/storage/userAnswers",
"question1":7,
"question2":true,
"question3":"will be better with cable tv and on-demand video"
}
},
"associate_state_task": "true",
"update_extensions": "true"
}
]
}
Result
HTTP 200 OK
location: /genesys/1/cs/services/111222/tasks/555666
{
services: [
{
service: {"service_id": 111222, "created": "false", "updated": "true" },
state: {"state_id": 333444, "created": "true", "updated": "false" },
task: {"task_id": 555666, "created": "true", "updated": "false" }
}
]
}
Create New Services
Operation
{
"create_new_services":true,
"services":[
{
"service":{
"interaction_id":"123ABCAADFJ1259ACF",
"application_type":"App_type_1",
"application_id":40,
"est_duration":60,
"customer_id":"${customer_id}",
"service_type":"MyService1",
"media_type":"voice",
"resource_id":1183,
"resource_type":"ResType1",
"RelatedOffersService":[
{
"offer_name":"VIP credit card black ed.",
"type":9,
"comments":"proposed to all client"
},
{
"offer_name":"3 times payment GOLD",
"type":4,
"comments":"limited offer"
},
{
"offer_name":"life insurance",
"type":3,
"comments":"healt check to be done before approval"
}
]
},
"state":{
"interaction_id":"123ABCAADFJ1259ACF",
"application_type":"App_type_1",
"application_id":40,
"resource_type":"ResType1",
"resource_id":1183,
"media_type":"voice",
"est_duration":60,
"state_type":"MyState1",
"FeedbackState":{
"FeedbackType":"survey",
"rating":7,
"notes":"warm welcome at frontdesk, thanks for the nice trip"
},
"SatisfactionState":[
{
"rating":2,
"pertinence":8,
"usefull":true,
"place":"Terranova mexico resort"
},
{
"rating":8,
"pertinence":4,
"usefull":false,
"place":"Fancy resort Paris"
}
]
},
"task":{
"interaction_id":"123ABCAADFJ1259ACF",
"application_type":"App_type_1",
"application_id":40,
"resource_type":"ResType1",
"resource_id":1183,
"media_type":"voice",
"est_duration":60,
"task_type":"MyTask1",
"FeedbackTask":{
"FeedbackType":"survey",
"rating":7,
"notes":"warm welcome at frontdesk, thanks for the nice trip"
},
"SatisfactionTask":[
{
"rating":2,
"pertinence":8,
"usefull":true,
"place":"Terranova mexico resort"
},
{
"rating":8,
"pertinence":4,
"usefull":false,
"place":"Fancy resort Paris"
}
]
},
"associate_state_task":"true"
}
]
}
Result
HTTP 200 OK
location: /genesys/1/cs/services/111222/tasks/555666
{
services:[
{
service:{
"service_id":111222,
"created":"false",
"updated":"false",
},
state:{
"state_id":333444,
"created":"true",
"updated":"false"
},
task:{
"task_id":555666,
"created":"true",
"updated":"false"
}
}
]
}