-
-
Save chase2981/d92bd1ef758b393dd0ac808ebfbc0baf to your computer and use it in GitHub Desktop.
| // task | |
| // snake case | |
| var taskJson = { | |
| // this shows up in flex on the task as the primary text | |
| "name": "[email protected]", | |
| // 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":"[email protected]", | |
| "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":{}} | |
| } |
Community call -> Processed by community
Community call -> Not processed by community -> Assigned to be processed by community
Community call -> Not processed by community -> Assigned to be processed by contact-center -> Needs listened to and processed by an agent
Community email -> Processed by community
Community email -> Not processed by community -> Assigned to be processed by community
Community email -> Not processed by community -> Assigned to be processed by contact-center -> Needs read and processed by an agent
Contact-center call -> Processed by contact-center
...
Call types:
Past -> Inbound -> Process based on recording
Present -> Inbound -> Process based on live call
Present -> Outbound -> Process follow up result
Chat Studio Flow "SendToAgent" Task Router Definition
{
"name": "{{trigger.message.ChannelAttributes.from}}",
"type": "short-lived",
"channelType": "{{trigger.message.ChannelAttributes.channel_type}}",
"channelSid": "{{trigger.message.ChannelSid}}",
"rdClientId":
"{{trigger.message.ChannelAttributes.pre_engagement_data.rdClientId}}",
"location": "{{trigger.message.ChannelAttributes.pre_engagement_data.location}}",
"rdChatWidgetId": "{{trigger.message.ChannelAttributes.pre_engagement_data.rdChatWidgetId}}",
"rdAdSourceId": "{{trigger.message.ChannelAttributes.pre_engagement_data.rdAdSourceId}}",
"rdUnitId": "{{trigger.message.ChannelAttributes.pre_engagement_data.unitId}}",
"rdForm": "{{trigger.message.ChannelAttributes.pre_engagement_data}}",
"rdJson": {{trigger.message.ChannelAttributes.pre_engagement_data.json | to_json}}
}
Inbound email in flex currently
{
"timeout": null,
"taskChannel": "email",
"attributes": {
"name": "[email protected]",
"type": "long-lived",
"startDate": "",
"communityGroupPriority": 10,
"isNewClient": true,
"clientId": 1,
"expertiseRequired": 7,
"overCallCapBy": 320,
"parentTaskSid": "",
"childTaskSid": "",
"direction": "inbound",
"contactCenterId":1,
"acceptable_contact_time": {
"sort": "GMT-5",
"min_utc": "0800",
"max_utc": "1630"
},
"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"
},
"transfer_context": {
"leadId": 3245621,
"transferredFromUserId": 291
},
"outcome": {
"completed_by_user_id": 291,
"users_engaged": [112, 291]
},
"search_result": {
"clientId": 195,
"resident": true
},
"search_context": {
"emailMessageId": 2132424
},
"autoAnswer":"false",
"referrer": "http://chat-demo.rentdynamics.com/",
"order": 0,
"rdStep": 0,
"rdClientId": 1,
"rdJson": {
}
}
}
Rent Dynamics Primary
task
{
"task_channel_sid":null,
"clientId":"4",
"customers":{
"phone":"4805593664",
"market_segment":"Circa and Ecco",
"organization":"Bridge Property Management",
"name":"UNKNOWN",
"custom_attr_1":false,
"category":"Circa and Ecco",
"customer_manager":"Bridge Property Management"
},
"task_channel_unique_name":null,
"contactCenterId":1,
"conferenceSid":"CA42caf1e391470e85f9317e42134dcebe",
"communityGroupId":"1515",
"rdStep":2
}
worker
{"overflow_status":1,"contact_center_id":1,"next_activity_sid":null}
Incoming call in flex currently
{
"from_country": "US","
called":"+12569063929",
"to_country": "US",
"to_city": "RANBURNE",
"type": "short-lived",
"to_state": "AL",
"caller_country": "US",
"call_sid": "CA94a15b35f506a28bbc66f036287bb1ee",
"rdJson": {
"rdClientId": 1
},
"account_sid": "AC2ff1caf629adc5fcb3e9b346104d54d9",
"from_zip": "84341",
"from": "+14358813912",
"direction": "inbound",
"called_zip": "36273",
"caller_state": "UT",
"to_zip": "36273",
"called_country": "US",
"from_city": "LOGAN",
"called_city": "RANBURNE",
"caller_zip": "84341",
"api_version": "2010-04-01",
"called_state": "AL",
"from_state": "UT",
"caller": "+14358813912",
"caller_city": "LOGAN",
"rdClientId": 1,
"name": " +14358813912",
"to": "+12569063929",
"conference": {
"sid": "CF71e1632ae4221519b36a7a5c3f6ca059",
"participants": {
"worker": "CAd2bf11a9e449d54b42c93bef3aa45ba2",
"customer": "CA94a15b35f506a28bbc66f036287bb1ee"
}
},
"conversations": {
"segment_link": "https://api.twilio.com/2010-04-01/Accounts/AC2ff1caf629adc5fcb3e9b346104d54d9/Recordings/RE820aaef4c90070d2e47ad842d319ea38"
}
}
Incoming chat in flex currently (Uses Studio flow noted above as a template)
{
"channelSid": "CH838b13d5604a4d3fbde5b1e874f62268",
"rdUnitId": "",
"rdClientId": "1",
"rdJson": {
"moveDate": "2021-02-11",
"phaseGroupId": 45,
"lastName": "Guy",
"note": "",
"preferredCommunicationTypeId": 1,
"isLead": true,
"clientId": 1,
"communityGroupId": 80,
"bedrooms": 3,
"firstName": "Demo",
"phoneNumber": "3234242424",
"communicationTypeId": 3,
"adSourceId": 2252,
"personId": 9041320,
"communityId": 45,
"email": "[email protected]",
"friendlyName": "Demo Guy",
"leadId": 9217834
},
"name": "Demo Guy",
"rdAdSourceId": "2252",
"channelType": "web",
"location": "http://chat-demo.rentdynamics.com/",
"rdChatWidgetId": "3",
"type": "short-lived",
"rdForm": "{communicationTypeId=3, bedrooms=3, communityGroupId=80, communityId=45, firstName=Demo, lastName=Guy, moveDate=2021-02-11, phoneNumber=3234242424, [email protected], isLead=true, adSourceId=2252, note=, preferredCommunicationTypeId=1, leadId=9217834, personId=9041320, phaseGroupId=45, friendlyName=Anonymous, clientId=1, json={communicationTypeId=3, bedrooms=3, communityGroupId=80, communityId=45, firstName=Demo, lastName=Guy, moveDate=2021-02-11, phoneNumber=3234242424, [email protected], isLead=true, adSourceId=2252, note=, preferredCommunicationTypeId=1, leadId=9217834, personId=9041320, phaseGroupId=45, friendlyName=Demo Guy, clientId=1}, rdChatWidgetKey=eab86709188c231559103444, rdChatWidgetId=3, rdAdSourceId=2252, rdClientId=1, rdCustomPreEngagement=true, location=http://chat-demo.rentdynamics.com/}"
}
Outbound call in flex currently
{
"to": "+14358813912",
"worker_call_sid": "CA919856b707de026c79f833b4a7f32585",
"name": "outgoing",
"internal": "false",
"conference": {
"sid": "CFb84e9a4ed264c8682e454c857294c521",
"participants": {
"customer": "CA893b939ac15554cec883d0bb2e06ec44",
"CA893b939ac15554cec883d0bb2e06ec44": "+14358813912",
"worker": "CA919856b707de026c79f833b4a7f32585"
}
},
"flexOutboundDialerTargetWorker": "client:chasewgibbons",
"direction": "outbound",
"autoAnswer": "true",
"from": "+14358813912",
"targetWorker": "client:chasewgibbons"
}
Another example
{
"to": "4359994722",
"worker_call_sid": "CAf1cec8e0151000967955143fd88b5ed5",
"name": "outgoing",
"internal": "false",
"conference": {
"sid": "CFb715b2e8b89abb79edbdc8ab670d7a54",
"participants": {
"customer": "CA1b93996d5dae7b84519fe649ba19a7ab",
"CA1b93996d5dae7b84519fe649ba19a7ab": "4359994722",
"worker": "CAf1cec8e0151000967955143fd88b5ed5"
}
},
"flexOutboundDialerTargetWorker": "client:chasewgibbons",
"direction": "outbound",
"autoAnswer": "true",
"from": "+14358813912",
"targetWorker":"client:chasewgibbons”
}
Worker attributes in flex currently
{
"public_identity": "Chase",
"manager": "Zach Passey",
"roles": [
"admin",
"wfo.full_access"
],
"last_name": "Gibbons",
"team_id": "1",
"team_name": "Hello",
"routing": {
"skills": [
"spanish_speaking",
"overflow_status"
],
"levels": {
"overflow_status": 10
}
},
"full_name": "Chase Gibbons",
"rd_username": "cgibbons",
"user_id": "291",
"phone": "+14359994722",
"rd_auth_token": "7975c687ab46687f9800ce8b38d55bac295d720ce2c3",
"contact_uri": "client:cgibbons",
"rd_user_id": "291",
"location": "Logan, UT",
"id": "6fc32e46-e6e2-43ac-bf95-4a79a1eefcdf",
"team_name_in_hierarchy": "Hello,Logan,UT",
"department": "Contact Center",
"first_name": "Chase",
"disabled_skills": {
"skills": [],
"levels": {}
},
"email": "[email protected]"
}
Another example with skills disabled
{
"public_identity": "Chase",
"manager": "Zach Passey",
"roles": [
"admin",
"wfo.full_access"
],
"last_name": "Gibbons",
"team_id": "1",
"team_name": "Hello",
"routing": {
"skills": [
"overflow_status"
],
"levels": {
"overflow_status": 10
}
},
"full_name": "Chase Gibbons",
"rd_username": "cgibbons",
"user_id": "291",
"phone": "+14359994722",
"rd_auth_token": "7975c687ab46687f9800ce8b38d55bac295d720ce2c3",
"contact_uri": "client:cgibbons",
"rd_user_id": "291",
"location": "Logan, UT",
"id": "398df5e2-df31-41a4-b120-14596510f49d",
"team_name_in_hierarchy": "Hello,Logan,UT",
"department": "Contact Center",
"first_name": "Chase",
"disabled_skills": {
"skills": [
"spanish_speaking"
],
"levels": {}
},
"email": "[email protected]"
}
Incoming sms attributes in flex currently
{
"channelSid": "CH8faa554d6b804f1eac73d675b53c6da1",
"name": "+14352612308",
"channelType": "sms"
}
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
}
There is tons of valuable info if you read and click through all the links here: https://www.twilio.com/docs/flex/developer/insights/enhance-integration
For instance,
Analytics data model:
https://www.twilio.com/docs/flex/end-user-guide/insights/data-model
Useful conversation attributes:
https://www.twilio.com/docs/flex/end-user-guide/insights/data-model#useful-attributes
Custom labels:
https://www.twilio.com/docs/flex/developer/insights/labels
Conversation structure:
https://www.twilio.com/docs/flex/end-user-guide/insights/conversation-structure