LogoLogo
HOMEAPPSBLOGDEVELOPERSGET A DEMO
  • Overview
    • Data
    • Middle's infrastructure
    • ENTERPRISE installations
    • Security
  • Workflows
    • Enable/disable an account
    • Connect or edit an app connection
    • Sync
      • Stored records
      • Sync history
    • Create or copy a workflow
    • Edit an existing workflow
    • Workflow steps
    • Workflow parameters
    • Triggers
  • User access
  • Performance
  • Data deletion
  • App development
    • Authentication
    • Credential storage
    • Sync records
    • Actions
    • Code packages
    • Upload scripts
    • Testing your apps
    • Versions
    • Monitor
  • Getting app credentials
    • ABC Ignite
    • Amazon S3
    • Clover
    • Emma
    • Erply
    • Facebook
    • fitDEGREE
    • Gmail
    • Google Sheets
    • HighLevel
    • Hubspot
    • Keap Max
    • Klaviyo
    • Lightspeed Retail
    • Mailchimp
    • Mindbody
    • OpenAI
    • Paramount Acceptance
    • Pike13
    • Salesforce
    • Shopify
    • Slack
    • Square
    • Vend
    • Xn
  • Guides
    • API limits
    • Building an API for Middle
    • Development best practices
Powered by GitBook
On this page

Was this helpful?

  1. App development

Code packages

Add code packages to Middle to streamline your coding

PreviousActionsNextUpload scripts

Last updated 2 years ago

Was this helpful?

Code Packages and Helper Functions

When writing your scripts for Records and Actions, you may want to import certain Python libraries or helper functions. Middle can support two import methods: code packages and upload mode.

Code Packages

The Code Packages section of your Middle app is useful when you want to upload Python code that can be accessed by all actions and scripts. You could upload your own Python file that has helper functions for your syncs, or you can upload helper libraries for the app you are integrating with.

To create a Code Package, click + Create next to Code Packages on the navigation bar.

Configure a code package with a name and description to explain its purpose. The Live boolean should be switched on when you want your scripts to access the package (all scripts must be re-saved to access it).

Upload a code package to reference in your scripts

A code package must be uploaded as a zip archive. The Python files within the package can be accessed by using an import statement within your action and poll sync scripts.

import requests # requests library is available for use
import datetime
from index import Restart, AuthenticationChanged
from coolnewapp_middle_utils import coolnewapp_api_request