Python helpers

search_imported_orders

Search the orders in a feed already synced into Octocom, one page at a time.

search_imported_orders(context, integration, filters=None, limit=100, cursor=None)

Searches an imported order feed for the conversation's business. It reads orders already synchronized into Octocom, rather than calling a live store API. It cannot read credentials or other integration metadata.

def execute_action(context):
    result = search_imported_orders(context, "my_order_feed", filters=[
        {"field": "email", "value": context["args"]["email"]},
        {"field": "orderNumber", "operator": "paddedEquals", "value": context["args"]["order_id"]},
    ], limit=10)
    return result

context["conversation"]["businessSlug"] is required. integration identifies the installed feed. Filters match top-level provider fields and are combined with AND. Operators are equals (the default, case-sensitive text comparison), paddedEquals (pad identifiers on the left with zeros to at least 12 characters), and phoneSuffix (compare the trailing digits after removing punctuation). Long identifiers are preserved. Phone suffix matching alone does not verify a customer's identity.

The result is {"items": [...], "nextCursor": "..." | None, "lastUpdated": "ISO8601"}. Provider field names and nested values are preserved. Results retain feed order, and limit is between 1 and 200. Follow nextCursor with the same integration and filters to read subsequent matches. A missing feed returns HTTP 404. Missing matches return an empty items array.

The cursor belongs to one feed snapshot. If the feed changes, HTTP 409 raises an error explaining how to restart without a cursor. Restart the whole lookup and discard partial results from the old snapshot. HTTP and timeout errors propagate; the helper does not silently retry or treat an error as no matches.