Python helpers

add_conversation_event

Record what your automation did in the conversation timeline, where agents and Bot QA can see it.

add_conversation_event(context: dict, event: str, subtext: str = None, details: str = None) -> dict

Records a timestamped event in the conversation's timeline. Agents see it in the conversation view, so they know what your automation did without digging through logs. For example, a refund action can record "Refund of $40 processed for order 1042".


Parameters

NameTypeDescription
contextdictThe context object passed to your action
eventstrThe event text to record (max 1000 characters)
subtextstrOptional secondary text (max 1000 characters)
detailsstrOptional plain-text hover details (max 12000 characters)

Returns

dict: {"success": bool, "message": str, "eventId": str}

Behavior

  • Skipped in test/mock environments.
  • Bot QA reads these events as evidence, so state the outcome plainly, for example "Refund processed" rather than "Refund step finished". Record the event before the AI replies about it: QA cannot see events written after it checks a reply.
  • Initiator information is assigned by the server from the authenticated execution.
  • New records use event: "event" with metadata.version: 1; historical records retain their original formats. See ticket activity events.

Examples

Log when a refund is processed

def execute_action(context):
    order_id = context["args"]["orderId"]
    amount = process_refund(order_id)

    add_conversation_event(context, f"Refund of ${amount} processed for order {order_id}")
    return {"success": True, "amount": amount}

Record a decision point

def execute_action(context):
    order = fetch_order(context["args"]["orderId"])

    if order["daysOld"] > 30:
        add_conversation_event(context, "Order outside 30-day return window — denied")
        return {"eligible": False, "reason": "Outside return window"}

    add_conversation_event(context, "Order eligible for return")
    return {"eligible": True}

On this page