Skip to content

Instantly share code, notes, and snippets.

@chase2981
Last active February 9, 2021 23:16
Show Gist options
  • Save chase2981/d92bd1ef758b393dd0ac808ebfbc0baf to your computer and use it in GitHub Desktop.
Save chase2981/d92bd1ef758b393dd0ac808ebfbc0baf to your computer and use it in GitHub Desktop.
Omnichannel Task Router Base Attributes
// task
// snake case
var taskJson = {
// this shows up in flex on the task as the primary text
"name": "chase@rentdynamics.com",
// differentiates between different task queues based on acceptable response times
"type": "short-lived",
"rd": {
// contactCenter -- we might not need this tbh -- especially if we do different flex projects or even different workspaces or workflows per contact center
"contact_center_id":1,
// spoken language
"spoken_language_required": "spanish",
// startDate
"start_date": "2021-02-04T02:35:14.466Z",
// clientId
"client_id": 1,
// communityGroupId if we have it
"community_group_id": 2,
// adSourceId here, then we'll put the adSourceName in the "conversations" sub-object
"ad_source_id": 124,
// could do this same thing using
"community_group_priority": 10,
// the following could handle all the training requirements
"worker_experience_required": 7,
// parent task when transferred to
"parent_task_sid": "XXSF...",
// this lets us know to show the follow up component on the frontend on the child task
"parent_task_channel_unique_name": "follow-up",
// this will be used to trigger search on the frontend if email
"email_message_id": 2132424,
// this will be used to trigger search on the frontend if call
"call_detail_id": 2132424,
// timing - what about holidays?
"acceptable_contact_time_min_utc": "0800",
"acceptable_contact_time_max_utc": "1630",
"acceptable_contact_time_utc": -7,
// the following will be used on the frontend to automatically go straight to a lead or resident, also it will be used when transferring a task to a supervisor
"lead_id": 3245621,
"resident_id": 435563,
// used in transfers
"transferred_from_user_id": 291,
// completion
"completed_by_user_id": 291,
"call_route_step?": 0,
...{ /* ... any other use-case specific attributes can be added here */ }
},
"targetWorker":"client:chasewgibbons", // outbpund call direct assignment added automatically by flex
"flexOutboundDialerTargetWorker": "client:chasewgibbons", // outbpund call direct assignment added automatically by flex
// direction
"direction": "inbound",
// todo: make this more robust
"conversations" : {
// s3 call recording link
"segment_link" : "https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings/REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
// parent taskSid to link followUps together in flex insights
"conversation_id" : "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
// whether or not conversation was productive
"productive": "true",
// example custom metric which doesn't count towards 2 billion unique values limit
"conversation_attribute_1" : "Google",
// links to above conversation_attribute_1
"conversation_label_1" : "AdSourceName",
// integer of some measure, it might link to the conversation_attribute_1 and conversation_label_1 above, idk, need to look this one up..
"conversation_measure_1" : 101,
// language used by participants in the conversation
"language": "spanish",
// outcome of conversation
"outcome": "no appointment set"
},
// todo: make this more robust
"customers":{
"phone":"3059867013",
"market_segment":"4th Street Commons",
"organization":"Asset Campus Housing",
"name":"JESSICA AUJLA",
"custom_attr_1":true,
"category":"4th Street Commons",
"customer_manager":"Asset Campus Housing",
// example custom metric which doesn't count towards 2 billion unique values limit
"customer_attribute_1" : "544532",
// links to above customer_attribute_1
"customer_label_1" : "LeadId",
// value of this customer to the business, greater equals more valuable
"business_value" : 7500
},
// dictates how flex behaves on frontend, this is added automatically on frontend direct assignments in certain instances as camelcase
"autoAnswer":"false",
// i'm not sure what this does tbh, but it is added on frontend automatically in certain instances
"internal":"false"
}
// worker
var workerJson = {
"public_identity":"Chase",
"contact_uri":"client:cgibbons",
"roles":["admin","wfo.full_access"],
"team_leader_sid": "",
"spoken_languages": ["english", "spanish"],
"overflow_status": 9,
// could do this same thing via
"experience_level": 9,
"first_name":"Chase",
"last_name":"Gibbons",
"full_name":"Chase Gibbons",
"rd_username":"cgibbons",
"user_id":"291",
"phone":"+14359994722",
"email":"chase@rentdynamics.com",
"rd_auth_token":"7975c687ab46687f9800ce8b38d55bac295d720ce2c3",
"manager":"Zach Passey",
"team_id":"1",
"team_name":"Hello",
"team_name_in_hierarchy":"Hello,Logan,UT",
"department":"Contact Center",
"department_id": "2",
// we might change this up a bit to allow arrays
"routing":{
"skills": ["spanish_speaking","overflow_status"],
"levels":{"overflow_status":10}
},
"disabled_skills":{"skills":[],"levels":{}}
}
@chase2981
Copy link
Author

Incoming follow up task attributes in flex currently

{
  "clientId": 1,
  "parentTaskSid": "",
  "autoAnswer": "false",
  "search_result": {
    "clientId": 195,
    "resident": true
  },
  "childTaskSid": "",
  "type": "short-lived",
  "search_context": {
    "emailMessageId": 2132424
  },
  "rdStep": 0,
  "overCallCapBy": 320,
  "acceptable_contact_time": {
    "min_utc": 1500,
    "sort": "GMT-5",
    "max_utc": 300
  },
  "transfer_context": {
    "transferredFromUserId": 291,
    "leadId": 3245621
  },
  "referrer": "http://chat-demo.rentdynamics.com/",
  "rdClientId": 1,
  "rdJson": {},
  "name": "Jon Doe",
  "isNewClient": true,
  "customers": {
    "phone": "3059867013",
    "market_segment": "4th Street Commons",
    "organization": "Asset Campus Housing",
    "name": "JESSICA AUJLA",
    "custom_attr_1": true,
    "category": "4th Street Commons",
    "customer_manager": "Asset Campus Housing"
  },
  "contactCenterId": 1,
  "startDate": "",
  "outcome": {
    "users_engaged": [
      112,
      291
    ],
    "completed_by_user_id": 291
  },
  "direction": "inbound",
  "order": 0
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment