
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@elasticpath/ih-automation
Advanced tools
This package provides:
Use the following commands to install this package.
yarn install @elasticpath/ih-automation
The following environment variables need to be set for this package to be able to access your Elastic Path environment. These are usually set in a locally maintained .env file in the repository root and the dotenv package is used to inject the variables from .env into the Node runtime.
EPCC_CLIENT_ID={replace with the client id of your EPCC application key}
EPCC_CLIENT_SECRET={replace with the client secret of your EPCC application key}
EPCC_API_DOMAIN={useast.api.elasticpath.com or euwest.api.elasticpath.com}
EPCC_INTEGRATIONS_HUB_API_DOMAIN={us-east-2.elasticpathintegrations.com or eu-west-1.elasticpathintegrations.com}
DEFAULT_LOG_LEVEL={error or warn or info or debug or trace}
The following code examples demonstrate how to perform some of the most common tasks.
This example saves the exported instances and their configurations to a JSON file.
import dotenv from "dotenv";
dotenv.config({ path: ".env" });
import * as epccIHAutomation from "@elasticpath/ih-automation";
import fs from "fs";
async function exportAllInstanceConfigurationsToJson() {
const instances = await epccIHAutomation .exportCustomerInstances();
const formattedInstanceConfigs = {
ihIntegrations: instances.map((instance) => ({
integrationName: instance.integration.name,
instanceName: instance.instance.name,
instanceDescription: instance.instance.description,
configVariables: instance.configVariables,
flowConfigs: instance.flowConfigs,
})),
};
fs.writeFileSync("instance-export.json", JSON.stringify(formattedInstanceConfigs, null, 2));
}
exportAllInstanceConfigurationsToJson();
This example upserts the integration instances and their configurations from the JSON file that was generated in the previous example.
import dotenv from "dotenv";
dotenv.config({ path: ".env" });
import { upsertIntegrationInstance, InstanceDetail } from "@elasticpath/ih-automation";
import fs from "fs";
async function importIntegrationsFromFile(filename: string) {
let instanceDetails: InstanceDetail[];
try {
const instanceDetailsFromFile = fs.readFileSync(filename, { encoding: "utf-8" });
const instances = JSON.parse(instanceDetailsFromFile);
instanceDetails = instances.ihIntegrations;
} catch (error) {
console.error("Could not parse JSON file: ", error);
throw error;
}
if (instanceDetails) {
try {
for (const instanceDetail of instanceDetails) {
await upsertIntegrationInstance(instanceDetail);
}
} catch (error) {
console.error("Could not upsert integration instance", error);
throw error;
}
}
}
importIntegrationsFromFile("output/instance-export.json");
Note that customers are not allowed to change integration instances to specific versions. Instances can only be created and updated to the latest available version. If you feel you need to specify a different version, please contact the Elastic Path Support Team.
import * as dotenv from "dotenv";
dotenv.config({ path: ".env" });
import { upgradeIntegrationInstanceByName } from "@elasticpath/ih-automation";
await upgradeIntegrationInstanceByName("SendGrid Email", true);
createStore(store: EPCCStore): Promise<CreateStoreResponse>Creates a new EPCC store. Requires an Organization-level Application Key for authorization.
store: EPCCStore object containing store detailsgetStores(): Promise<OrganizationStore[]>Fetches all stores for the organization. Requires an Organization-level Application Key for authorization.
switchSessionToOrg(orgId: string): Promise<SwitchStoreResponse>Switches the current session to a specified organization. Requires an Organization-level Application Key for authorization.
orgId: The ID of the organization to switch toswitchStoreInOrg(storeId: string): Promise<SwitchStoreResponse>Switches to a specific store within the current organization. Requires an Organization-level Application Key for authorization.
storeId: The ID of the store to switch togetJWT(): Promise<string>Fetches the EPCC JWT token for authentication.
integrationHubAuthenticate(jwt: string): Promise<void>Authenticates with the Integrations Hub using a JWT token.
jwt: The JWT token for authenticationgetIHCustomerId(): Promise<string>Retrieves the Integrations Hub Customer ID for the authenticated user.
getCurrentIntegrationIdByName(name: string): Promise<GetIntegrationResponse>Retrieves the current integration ID by its name.
name: The name of the integrationgetIntegrationInstanceByName(name: string): Promise<GetInstanceResponse>Retrieves an integration instance by its name.
name: The name of the integration instancecreateIntegrationInstance(ihCustomerId: string, instanceDetails: InstanceDetail, flowConfigs?: InputFlowConfig[]): Promise<CreateInstanceResponse>Creates a new integration instance.
ihCustomerId: The Integrations Hub customer IDinstanceDetails: Details of the instance to createflowConfigs: Optional flow configurationsupdateIntegrationInstanceConfiguration(instanceDetails: InstanceDetail, flowConfigs?: InputFlowConfig[]): Promise<UpdateInstanceResponse>Updates an existing integration instance configuration.
instanceDetails: Details of the instance to updateflowConfigs: Optional flow configurationsdeployIntegrationInstance(instanceId: string): Promise<string>Deploys an integration instance.
instanceId: The ID of the instance to deployupgradeIntegrationInstanceByName(instanceName: string, deployNewInstance = true): Promise<void>Upgrades an integration instance to the latest version. Please note that this process will only work properly if the configuration variables in the new version are backward compatible with the current version. This does not modify the config variables for the instance in any way.
instanceName: The name of the instance to upgradedeployNewInstance: Whether to deploy the new instance after upgrade (default: true)getCustomerInstances(ihCustomerId: string): Promise<InstancesResponse[]>Retrieves all instances for a customer (limited to first 100).
ihCustomerId: The Integrations Hub customer IDexportCustomerInstances(): Promise<InstancesResponse[]>Exports all customer integration instances.
upsertIntegrationInstance(...instanceDetails: InstanceDetail[]): Promise<InstanceDetail[]>Creates or updates integration instances.
instanceDetails: The instance details to create or update (spread parameter)authorizeConnections(authorizeUrls: string[]): Promise<void>Authorizes connections using provided authorization URLs.
authorizeUrls: Array of URLs to authorizeinviteUsers(storeId: string, users: string[]): Promise<InviteUsersResponse>Invites users to a store with seller-admin role.
storeId: The ID of the store to invite users tousers: Array of user emails to inviteFAQs
Tools to automate common Elastic Path Integrations Hub tasks
We found that @elasticpath/ih-automation demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.