Python helpers
Built-in functions your Python calls with no import, from conversation tags to order lookups.
Python helpers are built-in functions your Python automations call directly, with no install or import. They handle the plumbing, so one line can tag a conversation, find an order or classify a message. For example, shopify_find_orders(context, email) returns a customer's orders without your code ever holding a Shopify token.
Helpers read and change conversations, send messages, call the platforms you've connected, reach any API from Octocom's fixed IP address, and run AI classification and summaries. Each helper has its own page with its signature, parameters, return value, limits and examples. The tables below group them by what they work on.
How helpers are used
Every Python automation defines one entry function that receives a context dictionary, and calls helpers from it:
| Where your code runs | Entry function | Conversation in context |
|---|---|---|
| Python actions | execute_action(context) | When the bot calls the action in a conversation |
| Condition providers | evaluate_conditions(context) | When evaluated for a conversation |
| Event handlers | handle_event(context) | For conversation events |
| Recurring jobs | run_job(context) | Never |
| HTTP endpoints | handle(context) | Never |
| Prompt sections | build_prompt_sections(context) | When the prompt is built for a conversation |
| Sidebar widgets | get_sidebar_data(context) | Always |
| Sidebar actions | execute_action(context) | Always |
| Phone line routers | route_call(context) | Never |
Most conversation helpers take context as their first argument and act on context["conversation"]. Where there is no current conversation, such as in recurring jobs and HTTP endpoints, pass conversation_id to the helpers that accept it: send_bot_message, close_conversation and resolve_human_decisions. Python context documents every field of context and which fields each automation type receives.
def execute_action(context):
reason = context["args"]["reason"]
add_conversation_tag(context, "cancel-requested")
set_data_collection_result(context, "cancel_reason", reason)
return {"success": True}Helpers limited to some automation types
A few helpers only run in the automation types where they are safe. Calling one elsewhere raises RuntimeError (for open_browser, its subclass BrowserAutomationError):
- Bot actions only:
hand_off_conversation,show_cardandask_confirmation. - Event handlers, recurring jobs and sidebar actions only:
send_bot_messageandclose_conversation, so nothing sends or closes while the bot is still deciding its reply. - HTTP endpoints, event handlers, recurring jobs and sidebar actions only:
resolve_human_decisions, so the bot can't approve its own request. - Saved bot actions, sidebar actions, event handlers, recurring jobs and HTTP endpoints only:
open_browser, because every browser run is attributed to a stored automation.
Tests and agent-written code
Many helpers skip their write and return a mock result when there is no conversation in context, for example in an editor test. Check a helper's page for how it behaves in tests.
You rarely need to write this code by hand. Describe the outcome to Copilot or any agent connected through Octocom MCP: it picks the helpers, writes the code, saves the automation and tests it.
Conversations
| Helper | What it does |
|---|---|
get_conversation_metadata | Read a metadata value from the conversation |
set_conversation_metadata | Write a metadata value, including keys with platform meaning |
delete_conversation_metadata | Delete a metadata key |
add_conversation_tag | Add a tag, creating it if needed |
remove_conversation_tag | Remove a tag from the conversation |
add_conversation_note | Add an internal note that only agents see |
get_conversation_notes | Read the internal notes already on the conversation |
add_conversation_event | Record an event in the timeline, which Bot QA uses as evidence |
set_data_collection_result | Store a result for analytics, filters and campaign KPIs |
upsert_customer | Create or update the customer linked to the conversation |
close_conversation | Close a conversation through the normal close pipeline |
hand_off_conversation | Hand the conversation to a human, or transfer a live phone call |
octocom_agents_available | Check whether any help desk agent is available right now |
live_chat_agents_available | Check whether anyone in the LiveChat handoff group is accepting chats |
request_human_decision and related helpers | Ask a teammate for a decision while the bot keeps the conversation |
set_message_sending_delay | Control how long the AI waits before sending its email replies |
Messages and chat UI
| Helper | What it does |
|---|---|
send_bot_message | Send fixed text to the customer through an existing conversation |
show_card | Show a card with label/value rows and buttons under the bot's reply in web chat |
ask_confirmation | Ask the customer to confirm with two buttons before the bot acts |
send_outbound_email | Email a customer and create a handed-off conversation for the reply |
send_transactional_email | Send a one-off email, for example to an internal team, without a conversation |
send_slack_notification | Post a message to a Slack channel through an incoming webhook |
add_campaign_recipients | Add people to a continuous phone campaign's calling queue |
| Klaviyo helpers | Subscribe, unsubscribe and record events in the business's Klaviyo account |
Chat UI from actions covers every UI item an action can return, beyond cards and confirmations.
Orders and shipping
| Helper | What it does |
|---|---|
shopify_get_order / shopify_find_orders | Find Shopify orders by number or email across every connected store |
shopify_get_customer / shopify_get_customer_orders | Find a Shopify customer, or their recent orders, by exact email |
shopify_graphql | Run any Shopify Admin GraphQL query or mutation |
woocommerce_get_order / woocommerce_find_orders | Find WooCommerce orders by number or email |
magento2_get_order / magento2_find_orders | Find Magento orders by number or email |
prestashop_get_order / prestashop_find_orders | Find PrestaShop orders by number or email |
bigcommerce_get_order / bigcommerce_find_orders | Find BigCommerce orders by number or email |
shoptet_get_order / shoptet_find_orders | Find Shoptet orders by number or email |
search_imported_orders | Search an order feed already synchronized into Octocom |
track_shipment | Look up live carrier tracking events (DHL, USPS) |
The order pages include the helpers' full Python source, so you can copy and adapt them. Each platform also has a <platform>_order_widget(context) helper for a read-only orders panel: see Order widgets.
Subscriptions
| Helper | What it does |
|---|---|
| Recharge subscription helpers | Look up, cancel, reschedule and discount Recharge subscriptions |
| Loop subscription helpers | Look up, cancel, reschedule and discount Loop subscriptions |
| WooCommerce Subscriptions helpers | Look up, cancel and reschedule WooCommerce Subscriptions |
Each provider also has sidebar helpers that show subscriptions with human-confirmed cancellation buttons: see Subscription widgets.
Google Sheets
Connect each spreadsheet in Integrations -> Google Sheets first. Google Sheets helpers explains access, limits, caching and safe retries.
| Helper | What it does |
|---|---|
list_google_sheets_tabs | List the tabs with their visibility and grid size |
list_google_sheets_rows | List or find rows by column values, with cursor pagination |
add_google_sheets_row | Append a row, optionally to a named tab |
update_google_sheets_row | Patch one uniquely identified row, failing safely if it moved |
read_google_sheets_range | Read cells by position, with hyperlinks, formulas, notes and merges |
write_google_sheets_range | Overwrite a bounded rectangle of cells |
clear_google_sheets_range | Clear values and formulas while keeping formatting and rows |
AI
| Helper | What it does |
|---|---|
llm_classify_binary | Answer a yes/no question about any text or data |
llm_classify_category | Pick one category from a list you provide |
llm_summarize | Summarize the conversation, or any text |
transcribe_pdf | Extract text from a PDF URL, including scanned pages |
Credentials and external access
Octocom doesn't limit you to a fixed menu of operations per platform. These helpers give your code the stored credentials of connected platforms, your own secrets and a fixed outbound IP, so it can call any API those systems offer, read a SQL Server database or drive a website. Integration patterns shows which building block fits each kind of system.
| Helper | What it does |
|---|---|
get_integration_credentials | Get the stored credentials of every connected integration, per business |
get_secret | Read an API key or token from your organization's secret vault |
proxy_request / proxy_session | Call an API from Octocom's fixed IP, for APIs that allowlist by IP |
fetch_via_proxy | Fetch a feed from Octocom's fixed IP in product-sync parsers |
sql_server_query | Run bounded SELECT queries against an external SQL Server |
open_browser | Drive a website through a guarded, audited browser session |
Product-sync parsers have their own set of network helpers: fetch_via_proxy, open_via_proxy and proxy_tcp_relay, plus shopify_graphql without the context argument.
Utilities
| Helper | What it does |
|---|---|
organization_store_* | Keep expiring, organization-wide JSON state with atomic compare-and-set |
get_ab_test_variant | Assign a sticky A/B test variant to the conversation |
is_holiday | Check whether a date is a public holiday in a country or region |
normalize_phone_number | Parse a phone number into international E.164 format |
render_pdf | Render an HTML document to a PDF and get a shareable link |
http_response | Choose the status code and headers an HTTP endpoint answers with |