Tokens
The unique state of each task is stored in Tokens. Tokens are JSON objects that contain aspects that describe the task and how it is being serviced. Points will add, modify, or remove data from tokens as a task is serviced.
Token Types
There are three types of Tokens.
Parent Token
The parent token is created when a task enters the MelodyArc Platform. It contains data that arrived with the task and metadata that is generated by the platform. Metadata may be updated by the platform as the task is serviced.
Generally, data in the parent token is not available for fill mechanisms when servicing, except when reachable via a reserved path.
Writing to the Parent Token
There are methods to write to the parent token. This is an advanced feature as data within the parent token will not reset when a token is restarted.
Example Parent Token
{
"_id": {
"$oid": "667586b2c33d4770c7b7712d"
}
"organization_id": "org_6654e38de6c08d77ca46a933",
"task_id": "667586b2c33d4770c7b7712c",
"task_type": "conversation",
"execution": {},
"created": {
"by": "webhook|org_6654e38de6c08d77ca46a933",
"at": 1718978226617,
"from_session": null,
"from_event": null
},
"last_updated": {
"by": "webhook|org_6654e38de6c08d77ca46a933",
"at": 1718978226617,
"from_session": null,
"from_event": null
},
"is_active": true,
"archived": false,
"archived_at": null,
"db_updated": {
"$date": {
"$numberLong": "1718978226734"
}
}
}
Data Token
The data token is the primary token used in servicing a task. Fill mechanisms evaluate if point inputs are met only from data within the data token. Point outputs are written to keys within the data token.
Data token data is housed within a root key of
data
Reduced snippet from a Data Token
{
"conversation": {
"organization_id": "org_6654e38de6c08d77ca46a933",
"dedupe_key": "128116985|1718978222000",
"task_id": 128116985,
"thread_id": 1718978222000,
"type": "conversation",
"queue": "created",
"state": "created",
"assigned_to": "none",
"updated_at": 1718978226623,
"updated_by": "webhook|org_6654e38de6c08d77ca46a933",
"created_at": 1718978226623,
"created_by": "webhook|org_6654e38de6c08d77ca46a933",
"first_scheduled_at": 1718978226615,
"remote_created_at": "2024-06-21T13:57:02+00:00",
"conversation": {
"message_id": 1718978222000,
"ticket_id": 128116985,
"channel": "email",
"customer": "[email protected]",
"crm": "gorgias",
"customer_name": "Stephen Johnson"
},
"processing_state": "processing"
},
"context_email": "[email protected]",
"orders": [
{
"id": 1006,
"customer": "[email protected]",
"number": 1006,
"name": "#1006",
"source_name": "1006",
"status": "Delivered",
"currency": "USD",
"total_price": "$549.00",
"total_tax": "0.00",
"total_shipping_price": "0.00",
"placed_timestamp": "2024-06-01T13:57:13.405Z",
"tracking_status": "DELIVERED",
"tracking_status_detail": "Your shipment was delivered.",
"ship_date": "2024-06-03T13:57:13.405Z",
"est_delivery_date": "2024-06-05T13:57:13.405Z",
"delivery_date": "2024-06-05T13:57:13.405Z",
"order_fulfilled_at": "2024-06-03T13:57:13.405Z",
"items": [
{
"id": 325602597,
"sku": "SKU_325602597",
"grams": 114,
"quantity": 1,
"name": "Appliance Product",
"title": "Appliance Product",
"variant_title": "Appliance Product",
"requires_shipping": true,
"product_category": "Appliance",
"is_appliance": true
}
],
"fulfillments": [
{
"id": 10061,
"shipment_status": "delivered",
"tracking_carrier": "MelodyArc Shipping",
"tracking_url": "https://track.melodyarc.com&tracknum=MA12365448799519",
"tracking_number": "MA12365448799519",
"line_items": [
{
"id": 325602597,
"sku": "SKU_325602597",
"grams": 114,
"quantity": 1,
"name": "Appliance Product",
"title": "Appliance Product",
"variant_title": "Appliance Product",
"requires_shipping": true,
"product_category": "Appliance",
"is_appliance": true
}
]
}
]
},
{
"id": 1007,
"customer": "[email protected]",
"number": 1007,
"name": "#1007",
"source_name": "1007",
"status": "In transit",
"currency": "USD",
"total_price": "$999.00",
"total_tax": "0.00",
"total_shipping_price": "0.00",
"placed_timestamp": "2024-06-15T13:57:13.405Z",
"tracking_status": "In transit",
"tracking_status_detail": "Your order is in transit.",
"ship_date": "2024-06-17T13:57:13.405Z",
"est_delivery_date": "2024-06-22T13:57:13.405Z",
"items": [
{
"id": 1006780746,
"sku": "SKU_1006780746",
"grams": 114,
"quantity": 1,
"name": "Lamp Product",
"title": "Lamp Product",
"variant_title": "Lamp Product",
"requires_shipping": true,
"product_category": "Lamp",
"is_appliance": false
}
],
"fulfillments": [
{
"id": 10071,
"shipment_status": "in_transit",
"tracking_carrier": "MelodyArc Shipping",
"tracking_url": "https://track.melodyarc.com&tracknum=MA12365448799520",
"tracking_number": "MA12365448799520",
"line_items": [
{
"id": 1006780746,
"sku": "SKU_1006780746",
"grams": 114,
"quantity": 1,
"name": "Lamp Product",
"title": "Lamp Product",
"variant_title": "Lamp Product",
"requires_shipping": true,
"product_category": "Lamp",
"is_appliance": false
}
]
}
]
}
]
}
Bot Token
The bot token is generated when a valid Configuration Point is activated. The bot token records the progress of the fill mechanisms. The bot token is generally used for deep diving the activation and outputs of points.
Bot token data is housed within a root key of
bot
Reduced snippet from a Bot Token
{
"_id": {
"$oid": "667586b73e8b789d1167818c"
},
"name": "cxa_v2",
"organization_id": "org_6654e38de6c08d77ca46a933",
"when": [
{
"crm.channel": {
"evaluate": true
}
}
],
"flows": [
{
"action": "undirected_fill",
"details": {
"name": "cxa_initialize_task",
"components": "enabled",
"repeatable": false,
"allow_additional_outputs": true,
"on_multiple_points": "sequential",
"on_no_points": "error",
"max_points": 20,
"partitions": ["cxa_initialize_task"]
},
"_id": {
"$oid": "667586b73e8b789d11678186"
},
"status": "completed",
"execution_count": 1,
"modified_at": 1718978232776
},
{
"action": "undirected_fill",
"details": {
"name": "cxa_preprocessing",
"components": "enabled",
"repeatable": false,
"allow_additional_outputs": true,
"on_multiple_points": "sequential",
"on_no_points": "error",
"max_points": 20,
"partitions": ["cxa_preprocessing"]
},
"_id": {
"$oid": "667586b73e8b789d11678187"
},
"status": "completed",
"execution_count": 1,
"modified_at": 1718978232947
},
{
"action": "undirected_fill",
"details": {
"name": "cxa_prepare_ticket",
"components": "enabled",
"repeatable": false,
"allow_additional_outputs": true,
"on_multiple_points": "sequential",
"on_no_points": "error",
"max_points": 20,
"partitions": ["cxa_prepare_ticket"]
},
"_id": {
"$oid": "667586b73e8b789d11678188"
},
"status": "completed",
"execution_count": 1,
"modified_at": 1718978233266
},
{
"action": "undirected_fill",
"details": {
"name": "cxa_get_demo_context",
"components": "enabled",
"repeatable": false,
"allow_additional_outputs": true,
"on_multiple_points": "sequential",
"on_no_points": "error",
"max_points": 20,
"partitions": ["cxa_get_demo_context"]
},
"_id": {
"$oid": "667586b73e8b789d11678189"
},
"status": "completed",
"execution_count": 1,
"modified_at": 1718978233503
}
]
}
Updated 2 months ago