LogoLogo
  • Getting Started
    • Pandium Documentation
    • What is Pandium?
      • The Pandium Platform
      • What Companies Use Pandium For
      • Platform Structure
      • Users of Pandium
    • Anatomy of an Integration
      • Run Triggers
      • PANDIUM.yaml
        • Schema
        • UiSchema
        • Dynamic Configurations
        • Dependent Selector Configurations
      • Environment Variables
        • Context: StdOut
        • Logging (StdErr)
    • Key Terminology
    • Pandium Integration Tutorial
      • Pokémon of the Day, Part 1
        • Create App in Slack to get Credentials
        • Create Integration on the Pandium Integration Hub
        • Make a Tenant
        • Write the Integration in Typescript
          • Add the .env
          • Configure the PANDIUM.yaml
          • Check the Customized Connection Settings Page
          • Add the Pokémon client
          • Add the Slack Client
          • Add the pokemonSync flow
          • Run Normal Sync on the Tenant
        • Update the Tenant Schedule
      • Pokémon of the Day, Part 2
        • Update the PANDIUM.yaml
        • Check the Updated Connection Settings Page
        • Add Dynamic Configs
        • Run Init Sync on the Tenant
        • Update the pokemonSync flow
        • Run updated Normal Sync on the Tenant
  • Integration Hub
    • Setting Up Source Control
    • Creating An Integration
      • Getting Started with Creating an Integration
      • Demo Video: Creating an Integration With Pandium
    • Managing Internal Integrations
    • Creating a Tenant In the Integration Hub
    • Managing and Updating Tenants
    • Managing and Updating Releases
    • Managing External Integrations
    • Managing Tenant Connection Settings
    • Creating Users
    • Managing Users
    • Administrator Settings
    • Site Metrics
  • Marketplaces
    • Integration Onboarding Experiences Overview
      • Embedding the In-App Marketplace
      • Embedding the Integration Install Only
      • Embedding Auth-Only Connections
    • Customizing the JWT
    • Marketplace Settings
    • App Installation Options
    • Flags, Tags, and Categories
    • Public Gallery
  • Connectors
    • Connectors 101
      • Active Campaign
      • Afterpay
      • AfterShip
      • Airship
      • Alasco
      • Algolia
      • Amadeus
      • Amazon
      • Ankored
      • Apollo.io
      • AppSignal
      • AskNicely
      • Assembled
      • Attentive
      • AWS
      • Azure Devops
      • Azure Personal Access Token
      • Bandcamp
      • Bazaarvoice
      • BigCommerce
      • Bitbucket
      • Booker
      • Box
      • Braze
      • Brightpearl
      • Campaign Monitor
      • Capabl
      • Chargebee
      • Chargify
      • Chubb
      • Cin7
      • Coach Packet
      • ConnectSports
      • Constant Contact
      • Customer Thermometer
      • Datadog
      • Datev
      • Delighted
      • DHL
      • DHL Unified
      • Domo
      • Dotdigital
      • Drip
      • Dropbox
      • Dynamic Yield
      • Easyship
      • Eloqua
      • Emotive
      • Endear
      • Envision
      • eTip
      • EvaluAgent
      • Exact Online
      • eZCom
      • Fabric
      • Facebook
      • Falcon.io
      • Famer
      • Fedex
      • Field Nation
      • Finch
      • Fivetran
      • Fleetio
      • Flowcode
      • Follow Up Boss
      • Fortnox
      • Foundation Software
      • Fulfil
      • GetResponse
      • GitHub
      • GitLab
      • Gladly
      • Google
      • Google Service Account
      • Gooten
      • Gorgias
      • Greenhouse.io
      • Happy Returns
      • HootSuite
      • Hubspot
      • Image Relay (Basic)
      • Imgur
      • Iterable
      • Jasper
      • JDP
      • Justuno
      • Kentico Kontent
      • Klaus
      • Klaviyo
      • Kombo
      • Kustomer
      • kvCORE
      • LeagueApps
      • Lessonly
      • Lexoffice
      • Linga rOS
      • Linnworks
      • Listrak
      • Loop Returns
      • LoyaltyLion
      • Lucid Travel
      • Lytx
      • MaestroQA
      • Magento (OAuth)
      • Mailchimp
      • Marketo
      • Medallia
      • Microsoft Entra
      • Mintsoft
      • NCSA Athletic Recruiting
      • Netomi
      • Netsuite
      • Nicereply
      • Nylas
      • Omnisend
      • OnPay
      • OnRamp
      • Ontraport
      • Optimizely Data Platform (ODP)
      • Pandium
      • Personio
      • PayCom
      • Perspective
      • Player's Health
      • Playvox
      • Pleo
      • Postscript
      • Promoter
      • Quickbooks Online
      • Qualtrics
      • Recart
      • ReCharge
      • Recurly
      • Returnly
      • ReverseLogix
      • Rydership (formerly Whiplash)
      • Sage Intacct
      • SailThru
      • Salesforce
      • Salesforce Marketing Cloud
      • Salesforce Pardot
      • SendGrid
      • Sendlane
      • SevenRooms
      • SFTP
      • ShipBob
      • ShipHero
      • ShipMonk
      • Shippo
      • Shipstation
      • Shopify
      • Skubana
      • Slack (OAuth2)
      • SmartrMail
      • Smartrr
      • Smartvatten
      • Smile.io
      • Solidus
      • Springbig
      • Square
      • Square (Sandbox)
      • Stamped
      • Stella Connect
      • SugarCRM
      • Swell
      • Talkable
      • TeamGenius
      • Tether
      • Thankful
      • TikTok
      • Trinet-B2B Test
      • Triple Whale
      • TrustPilot
      • Twilio
      • Twitter
      • Unbabel
      • UPS
      • Upscribe
      • USPS
      • Visma e-conomic
      • Visma.net
      • Walmart
      • Wix
      • WorkMax
      • Xero (OAuth)
      • Yardstik
      • Yotpo
      • Zendesk (Support)
      • Zingtree
      • Zonos
  • Partners
    • Inviting Partners
    • Partner Form
    • Integration Form
    • Managing Partners
    • Partner User Guide
  • Reference
    • Pandium API
    • Pandium CLI
    • FAQ
    • Sample Integrations
    • Repository Permissions
      • Bitbucket
      • Azure
      • GitLab
      • GitHub
    • Email Support
Powered by GitBook
On this page
  • What Are Run Triggers?
  • Run Triggers in Integration Code
  • Run Trigger Examples

Was this helpful?

  1. Getting Started
  2. Anatomy of an Integration

Run Triggers

Last updated 1 year ago

Was this helpful?

What Are Run Triggers?

End users can initiate syncs on a Pandium tenant in multiple ways: via a regular schedule, by clicking a button in the In-App Marketplace, or by sending a webhook. Pandium customers can also design their own mechanisms to trigger syncs by using the Pandium API.

Integration scripts can be written to handle one or more of these methods; it is possible for a single integration script to handle more than one trigger type. The code can even be customized to respond differently depending on the run trigger method.

Additionally, API and webhook triggers can contain information in the payload body that Pandium makes available to the integration code.

If planning for an integration to only ever run via scheduled job or be triggered manually, run triggers can safely be ignored.

Run Triggers In Depth

Pandium represents the four ways that users can trigger runs via four different modes: API, Webhook, Cron, and Manual.

Crons are scheduled syncs. Manual syncs are triggered after clicking a button within either the Integration Hub or In-App Marketplace. API and webhooks triggers are self-explanatory.

Pandium debounces triggers in order to prevent more than one sync happening per tenant at any given time. If a sync request comes in while the integration script is running for a tenant, Pandium will bundle the triggers and pass them into a new run that will start when the current run is completed.

Crons are scheduled in their own, discrete queue and given priority over other types of runs. This ensures scheduled syncs do not fall behind. Crons are only ever bundled with other cron jobs, but the other three trigger types can coexist on a single run trigger array.

On the other hand, if the integration is going to be receiving payloads when it is triggered by a webhook or API call, understanding run triggers and how to access them in your code is key.

Run Triggers in Integration Code

Within a run's , the run triggers array is stored in the PAN_CTX_RUN_TRIGGERS. A trigger is a JSON object that contains information about how the run started, including run mode (init or normal), trigger source, and payload data as well as any headers it was sent with.

If you're writing an integration that is receiving webhooks or API requests with payloads, the payload data is stored in a file that can be accessed using your language's built-in file reading functionality.

As an example, below is a script in Javascript that gets the run triggers/payloads from the Pandium context inside an integration:

const runTriggers = JSON.parse(process.env.PAN_CTX_RUN_TRIGGERS)
const payloads = []
for (const trigger of runTriggers) {
      // Only webhooks and API triggers have payloads
      if trigger.mode === 'webhook') {
        const data = fs.readFileSync(trigger.payload.file, 'utf-8')
        // do something with data from payload
      }
}

Run Trigger Examples

The run triggers exposed to your integration via environment variables will have one of the following modes: cron, manual, webhook, or api.

Below is an example of a webhook trigger:

{
    "id": "4731234254284123",
    "source": "webhook",
    "payload": {
        "file": "sample/test_file.txt",
        "headers": {
            "User-Agent": "PostmanRuntime/7.29.0"
        }
    },
    "created_date": "2023-01-27T23:27:07Z",
    "mode": "webhook"
}

Below is an example of an API trigger:

{
    "id": "12345678",
    "source": "api",
      "payload": {
        "file": "sample/test_file.txt",
        "headers": {
            "User-Agent": "PostmanRuntime/7.29.0"
        }
    },
    "created_date": "2023-06-06T10:11:50-04:00",
    "mode": "normal"
}

Below is an example of a manual trigger:

{
    "id": "12345678",
    "source": "manual",
    "created_date": "2023-06-06T10:11:50-04:00",
    "mode": "init"
}

Below is an example using cron:

{
    "id": "example_id",
    "source": "cron",
    "created_date": "2023-06-06T10:11:50-04:00",
    "mode": "normal"
}

context
environment variable