Python Helpers
Built-in helper functions available in all Python-based features — custom actions, condition providers, event handlers, and sidebar widgets.
All Python-based features in Octocom share the same set of built-in helper functions. Whether you're writing a custom action, a condition provider, an event handler, or a sidebar widget, these helpers are available in your code without any imports.
Click any function name for full documentation with parameters, return types, and examples.
Conversation data
| Helper | What it does |
|---|---|
get_conversation_metadata(context, key) | Read a metadata value from the conversation |
set_conversation_metadata(context, key, value) | Write a metadata value to the conversation |
delete_conversation_metadata(context, key) | Delete a metadata key from the conversation |
add_conversation_tag(context, tag) | Add a tag to the conversation |
add_conversation_event(context, event) | Record an event in the conversation timeline |
hand_off_conversation(context, reason=None) | Hand off the conversation to a human agent |
LLM classification
| Helper | What it does |
|---|---|
llm_classify_binary(prompt, input, fallback=None) | Classify input as True or False using an LLM |
llm_classify_category(prompt, input, options, fallback=None) | Classify input into one of the provided categories |
Experimentation
| Helper | What it does |
|---|---|
get_ab_test_variant(context, test_name, possible_variants) | Get a sticky A/B test variant for this conversation |
Utilities
| Helper | What it does |
|---|---|
add_google_sheets_row(sheet_id, data) | Append a row to a Google Sheet |
send_slack_notification(webhook_url, text) | Send a notification to a Slack channel via webhook |
is_holiday(country, state=None, region=None, check_date=None) | Check if a date is a public holiday |
send_outbound_email(context, params) | Send an outbound email creating a new handed-off conversation |
Shopify integration
| Helper | What it does |
|---|---|
shopify_get_customer(context, email) | Look up a Shopify customer by email |
shopify_get_customer_orders(context, email) | Retrieve a customer's orders from Shopify |
Klaviyo integration
| Helper | What it does |
|---|---|
klaviyo_subscribe_to_list(context, email, list_id) | Subscribe an email to a Klaviyo mailing list |
klaviyo_suppress_profile(context, email) | Globally suppress/unsubscribe a Klaviyo profile |
klaviyo_create_event(context, email, event_name, properties={}) | Create a custom event in Klaviyo |
klaviyo_get_lists(context) | Retrieve all mailing lists from Klaviyo |
All Python functions receive a context dictionary with conversation data, customer profile, and more. See Python Context for the full reference.