Ai knowledge and logicHelpers

get_integration_credentials

Retrieve the stored third-party integration credentials for every business in your organization.

get_integration_credentials(context: dict) -> dict

Returns the raw credentials of the third-party integrations installed on your businesses — API tokens, access tokens, and related identifiers — so your Python code can call those platforms' APIs directly when the built-in actions don't cover your use case.

The result covers every business in your organization, keyed by business slug. Businesses with no credential-exposing integrations are omitted.

Security. These are live production credentials. Only use them inside your action's code to call the third-party API — never log them, store them in conversation metadata, or include them in a bot response.


Parameters

NameTypeDescription
contextdictThe context object passed to your action

Returns

dict — Keyed by business slug. Each value is a dict keyed by integration name, holding that integration's credentials:

{
    "acme-corp": {
        "shopify": {
            "domain": "acme.myshopify.com",
            "accessToken": "shpat_...",
        },
        "zendesk": {
            "subdomain": "acme",
            "apiKey": "...",
        },
        "recharge": {"apiToken": "..."},
        "loop": {"apiToken": "..."},
    },
    "acme-corp-de": {
        "shopify": {
            "domain": "acme-de.myshopify.com",
            "accessToken": "shpat_...",
        },
    },
}

Supported integrations

IntegrationFieldsNotes
shopifydomain, accessTokenAdmin API access token for the shop at domain.
zendesksubdomain, apiKeyUse as a Bearer token: Authorization: Bearer {apiKey} against https://{subdomain}.zendesk.com.
rechargeapiTokenRecharge Admin API token.
loopapiTokenLoop Subscriptions API token.

Integrations that don't expose credentials (or aren't installed) simply don't appear in the result.


Example

Get the credentials for the current business

def execute_action(context):
    slug = context["conversation"]["businessSlug"]
    credentials = get_integration_credentials(context).get(slug, {})

    shopify = credentials.get("shopify")
    if shopify is None:
        return {"error": "Shopify is not installed for this business."}

    # Call the Shopify Admin API with shopify["domain"] and shopify["accessToken"]
    ...

On this page