English
Groovy Code Example
About 241 wordsLess than 1 minute
2026-01-09
/**
* @codeName Call Center Callback Function Template
*/
// Placeholder {eventType} from request URL configuration
Fx.log.info("Received event type: " + eventType);
Fx.log.info("Received parameters: " + externalDataMap);
Map resultMap = [:];
/**
* Process different logic based on eventType, using unified API call template with methodName and args differentiation
*/
// (1) To query bound configuration of current enterprise and agent information of current user
String methodName = "queryBindInfo";
// Agent ID
Map args = ["seatId": "2002"];
// Unified API call template
def ret = Fx.proxy.callAPI("eservice.proxy", ["x-fs-methodname": methodName,"Content-Type": "application/json;charset=UTF-8"], ["args": args]);
HttpResult result = ret.data as HttpResult;
Map map = result.content as Map;
// (2) To get popup window URL in third-party system
// String methodName = "getPopWindowUrl";
// seatId: Agent ID customerNum: Customer number
// Map args = ["seatId": "2002", "customerNum":"18390940098"];
// *** Use unified call template and assemble map result ***
// resultMap = ["url": (map.data as Map).url];
// Fx.log.info("Popup URL: " + resultMap);
// (3) To show popup in Fxiaoke system [customer service console popup], typically called on ring
// String methodName = "popWorkbench"
// seatId: Agent ID customerNum: Customer number callId: Call record ID callType: Call type in/inbound out/outbound
// Map args = ["seatId": "2002", "customerNum":"18390940098", "callId":"medias_3-1671505262.109912", "callType":"in"];
// (4) After step 3, must hide popup window, typically called on hangup
// String methodName = "hangupHandle"
// callId should be same as in step 3
// Map args = ["callId": "medias_3-1671505262.109912"];
return resultMap;