Skip to main content

AWS Redshift to Holded product stock

Read rows from AWS Redshift table using them to update product stocks using Holded API

Share

Read rows from AWS Redshift table

Used integrations:
class AwsRedshiftSourceSelect {    async init() {        // TODO: Create your aws-redshift credential        // More info at https://docs.yepcode.io/integrations/aws-redshift/#credential-configuration        this.awsRedshift = yepcode.integration.awsRedshift(            "your-aws-redshift-credential-name"        );        // TODO: Customize the command to be executed        // More info at https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-redshift-data/interfaces/executestatementcommandinput.html        const {            Id        } = await this.awsRedshift.send(            new ExecuteStatementCommand({                ClusterIdentifier: "your-cluster-identifier",                Database: "your-database-name",                DbUser: "your-database-user",                Sql: "SELECT * FROM your-table-name;",            })        );        this.statementId = Id;        await this._awaitStatementToFinish();    }    async fetch(publish, done) {        let nextToken;        // if result is returned paginated, iterate to publish entire statement result        do {            const result = await this.awsRedshift.send(                new GetStatementResultCommand({                    Id: this.statementId,                    NextToken: nextToken,                })            );            nextToken = result.NextToken;            for (const record of result.Records) {                // Each record come as a list of record cells                // More info at https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-redshift-data/interfaces/getstatementresultcommandoutput.html                // TODO: Customize record columns mapping to the item that will be published                const item = {                    id: record.id,                    ...record                };                await publish(item);            }        } while (nextToken);        done();    }    async close() {}    _awaitStatementToFinish() {        return new Promise((resolve, reject) => {            const describeStatementCommand = new DescribeStatementCommand({                Id: this.statementId,            });            // Configure interval to check statement status            const intervalId = setInterval(async () => {                const result = await this.awsRedshift.send(describeStatementCommand);                if (result.Status === "FINISHED") {                    clearInterval(intervalId);                    resolve();                    return;                }                if (result.Status === "FAILED" || result.Status === "ABORTED") {                    clearInterval(intervalId);                    reject();                    return;                }            }, 1000);        });    }}

Update product stocks using Holded API

Used integrations:
class AxiosTargetHoldedUpdateStock {    async init() {        // TODO: Create your axios credential with holded information:        // More info at https://docs.yepcode.io/integrations/axios/#credential-configuration        // baseUrl: https://api.holded.com/api/        // HTTP Headers:        //   {        //     "key": "your-access-token",        //     "Content-Type": "application/json"        //   }        this.axiosClient = yepcode.integration.axios(            "your-axios-holded-credential-name"        );    }    async consume(item) {        // TODO: Customize your request checking the API documentation:        // https://developers.holded.com/reference/update-product-stock        await this.axiosClient.post(            `/invoicing/v1/products/${item.productId}/stock`, {                stock: {                    warehouseId: item.stock                }            }        );    }    async close() {}}

Find related recipes

  • AWS Redshift
  • Holded

FAQs

These recipes are a good starting point for you to build your own YepCode processes and solve your integration and automation problems.

YepCode is a SaaS platform that allows to create, execute and monitor integrations and automations using source code in a serverless environment.

We like to call it the Zapier for developers, since we bring all the agility and benefits of NoCode tools (avoid server provisioning, environment configuration, deployments,...), but with all the power of being able to use a programming language like JavaScript with a NodeJS engine.

You only have to fill the sign up form and your account will be created with our FREE plan (no credit card required).

YepCode has been created with a clear enterprise approach (multi-tenant environment, team management, high security and auditing standards, IdP integrations, on-premise options,...) so we can be the Swiss army knife of any team of engineering, especially those that need to extract or send information to external systems, and where a certain dynamism or adaptation to change is necessary in that process.

Sure! You just need to do some configuration to allow YepCode servers to connect to that service. Check our docs page to get more information.

Ask us for help to solve your integration problem

Recipes may be used in a self service approach cloning them to one YepCode account, but if you are looking for a turnkey approach, our team may help you.