Integration patterns
Pick the right building block for any external system, from a modern API to a website with no API.
Octocom connects to any system your business runs on, whether it offers a modern API, needs an app install or has only a website. This page shows which building block fits each kind of system, and why.
There is no fixed list of operations. An AI agent assembles the building blocks for your exact process. Where a platform grants API access only through an installed app or a sign-in, such as Shopify or Notion, its connector handles access. Your code then calls the platform's API, so it can do anything that API allows.
This is the technical companion to Connect any system.
Decision guide
Start from what the external system offers, or what needs to happen.
| Situation | Use | Why |
|---|---|---|
| The system has a REST or GraphQL API with an API key | API action or Python action with get_secret | Any endpoint, any sequence of calls, with the key kept in the secret vault |
| The platform grants API access only through an app install or OAuth | The ready-made connector, then get_integration_credentials or shopify_graphql | The connector handles access; your code calls the full platform API |
| The system only has a website | Browser automation | Guarded, audited steps through the same pages a person uses |
| The system pushes events to you (callbacks, form posts) | Custom HTTP endpoint | A URL backed by your Python, live without a deployment |
| The system needs to hear about Octocom events | Webhooks (no code) or event handlers (Python) | Signed, retried deliveries, or custom logic on every event |
| The system needs to call Octocom | REST API with a scoped API key | A stable HTTP contract for your backend |
| You run a messaging channel Octocom has no connector for | Two-way messaging plus a webhook | Push customer messages in over REST and receive every reply on your endpoint |
| Data must be synced or polled on a schedule | Recurring job | Scheduled Python, no external cron server |
| The data is in a SQL Server database | sql_server_query | Bounded, read-only queries with the credential kept in a secret |
| The data is in a Google Sheet | Google Sheets helpers | Read, append and update rows and ranges in connected spreadsheets |
| A product catalog comes from a feed or API | Product sync parser | Python that turns any XML, CSV or JSON source into searchable catalog rows |
| The API only accepts allowlisted IP addresses | proxy_request and proxy_session, or fetch_via_proxy in product sync parsers | Requests leave from one stable Octocom IP address you can allowlist |
| You need to create or read PDFs | render_pdf and transcribe_pdf | Generate documents from HTML, or extract text with OCR |
| A person must make a decision | Human-in-the-loop decisions or external decisions | The AI agent keeps the conversation while a teammate or outside reviewer decides |
| Your agents should see the data while they work | Sidebar widgets and sidebar actions | Live data and buttons next to every conversation |
Most real integrations combine several of these. A returns process might use a Python action to look up the order, a human decision for exceptions, an event handler to update the CRM when the conversation closes, and a recurring job to retry anything the CRM rejected.
APIs with a key
Use an API action for a single request with no logic: configure the URL, method, headers and body in the dashboard or with create_api_action, and mark inputs with $variableName. Use a Python action when you need several calls, validation, data shaping, or the key stored as a secret instead of in the action's configuration.
Store the key once with Settings -> Advanced -> Secrets or create_organization_secret, then read it by name:
def execute_action(context):
key = get_secret("MONDAY_API_KEY")
response = requests.post(
"https://api.monday.com/v2",
headers={"Authorization": key},
json={"query": "{ boards(limit: 1) { id name } }"},
timeout=30,
)
response.raise_for_status()
return response.json()API actions call public HTTP and HTTPS endpoints; private and internal network addresses are blocked. Share Python code between actions, condition providers, event handlers and jobs with Python modules.
Platforms that require an app install or OAuth
Some platforms only grant API access through an installed app or an OAuth sign-in. Install the ready-made connector by asking Copilot, or for most platforms under Settings -> Workspace -> Integrations. Then call the platform's API from Python:
get_integration_credentials(context)returns the stored credentials of every connected integration that exposes them, keyed by business slug. The helper page lists each integration and its fields.shopify_graphqlruns any Shopify Admin GraphQL query or mutation. Octocom attaches the store's token and sends the request from its fixed IP, so your code never holds the token.- Ready-made order and subscription helpers (Shopify, WooCommerce, Recharge and others) ship with their full source, as starting points you can adapt.
Agents can call list_integrations to see what each business has installed, and whether Python can read its credentials, before asking anyone for a key.
Systems without an API
Browser automation works with portals and back-office tools that only have a website. Explore the site with Copilot or the MCP browser tools, then save the verified steps as a Python action that uses open_browser. Every step checks the expected page state before and after it acts, and each run keeps audit evidence. In Copilot, clicks, edits and key presses during exploration ask for your approval first.
Events in both directions
- The external system notifies Octocom. Create a custom HTTP endpoint: a URL that runs your Python
handle(context)function. Endpoint URLs have no built-in authentication, so verify a shared token or the sender's signature at the start ofhandle, before any side effect. - Octocom notifies the external system. Use a webhook to POST signed JSON to your URL when a conversation is created, closed, handed off, tagged or rated, or when a message is sent. Use an event handler when the reaction needs logic, such as updating a CRM only for certain tags.
- The external system calls Octocom. Use the REST API with an API key limited to the scopes it needs. For a messaging channel you run yourself, the two-way messaging API pushes customer messages in and delivers every reply on a webhook.
Schedules and polling
A recurring job runs Python on a cron schedule in the timezone you choose. Use it to sync records, poll a system that cannot push events, retry failed updates, or send a daily digest. Schedules run at most every 5 minutes, and each run has 5 minutes of elapsed time. For real-time reactions, use an event handler, a webhook or an HTTP endpoint instead.
To carry state between runs or between conversations, such as "orders to check again tomorrow", use the organization store.
Databases and spreadsheets
- SQL Server.
sql_server_queryruns boundedSELECTqueries. The connection details live in a JSON secret, Python never receives the stored password, and by default the login must be a dedicated read-only one. - Google Sheets. Connect the spreadsheet once, then use the Google Sheets helpers to list, append and conditionally update rows, or read and write ranges. Sheets work well as a shared log, a lookup table your team maintains, or a queue a person reviews.
Fixed IP addresses
Some APIs only accept requests from allowlisted IP addresses, or block cloud IP ranges. Route those calls through Octocom's stable outbound IP with proxy_request or proxy_session in actions, condition providers, event handlers, recurring jobs, HTTP endpoints and sidebar widgets, or with fetch_via_proxy in product sync parsers. The helper page lists the address to add to the provider's allowlist.
Files and PDFs
render_pdf(html, filename)turns a self-contained HTML document into a PDF and returns a shareable link, for invoices, quotes, certificates or reports.transcribe_pdf(url)extracts text from a PDF at a public URL, including scanned pages.- Public files host images and documents at permanent public URLs for articles, workflows and actions.
People in the loop
- The customer confirms. In web chat, an action can ask the customer to confirm with
ask_confirmationbefore anything irreversible, such as cancelling an order. See Chat UI from actions. - A teammate decides.
request_human_decisionshows a decision card to your team while the AI agent keeps the conversation, then continues from the recorded outcome. - Someone outside Octocom decides. The external decisions playbook sends a supplier or warehouse a review link, or takes the decision from another system's API call.
- Agents see the data. Sidebar widgets show records from your systems next to each conversation, with buttons that run sidebar actions.
- The team is notified.
send_slack_notificationandsend_transactional_emailalert people from any automation.
Security practices
- Least privilege. Give each integration its own key with only the permissions it needs, both in the external system and for Octocom API keys. For SQL Server, use a dedicated read-only login.
- Keep credentials in secrets. Never hard-code a key, log it, return it from an action or store it in conversation metadata. Octocom removes stored secret values from output, but only in the exact form they were stored, so never print a secret even partially.
- Return only what the customer may see. An action's result is visible to the AI agent and can reach the customer. Return the fields it needs, and abstract sensitive values (
inStock: truerather than an exact stock count). - Verify the customer before acting. Require matching identifiers, such as email and order number, before returning protected data or changing anything. See Authentication and access control.
- Confirm destructive actions. Ask the customer to confirm, or ask a teammate to decide, before refunds, cancellations and other irreversible changes.
- Make retries safe. Use the idempotency features the building blocks provide:
externalIdwhen you push messages or import history through the REST API, the delivery ID on webhooks, thekeyof a human decision request, theidempotency_keyofsend_bot_message, and compare-and-set in the organization store. Never blindly resend a write after an ambiguous error. - Set timeouts. Python actions have a 120-second budget including HTTP calls, and API actions time out after 1 to 60 seconds. Give each outbound request a shorter timeout so the action can handle a slow system itself.
- Authenticate inbound calls. Verify a token or signature at the start of every HTTP endpoint, and verify the signature of every webhook you receive.
Test before going live
- Test the code. Each code building block has a test tool that runs it with real inputs:
test_api_action,test_python_action,test_condition_provider,test_event_handler,test_recurring_job,test_http_endpoint,test_sidebar_widgetandtest_webhook.run_pythonruns one-off code with the same helpers without saving anything. Tests execute real code and can make real changes in the external system, so test against safe records. - Test the conversation. Enable the action in a workflow, then run test conversations that cover the normal path, missing data and failures. Agents can drive them with
start_conversationandsend_message. - Watch the first runs. Check execution history (
list_recurring_job_executions,list_http_endpoint_invocations,list_webhook_deliveries), and subscribe to the Automation Execution Failed event to hear about failing actions and condition providers. - Keep a way back. Actions, condition providers, recurring jobs, HTTP endpoints and workflows keep every version. See Change history and restore.
For extra assurance on complex integrations, Octocom's solution engineers can review the design, test it with you and help plan the rollout.