# Commercetools FaaS App

### Installation <a href="#od_ef51fe98" id="od_ef51fe98"></a>

#### Prerequisites <a href="#od_ef51fe98-1" id="od_ef51fe98-1"></a>

* Nginx
* PM2
* Nodejs > v16.10.0
* Certbot

#### Step 1. Download and install <a href="#od_1e92263f" id="od_1e92263f"></a>

To install the DAM module, please follow the steps below:

* 1\.  [Download Latest release of the Module](https://github.com/scaleflex/commercetools-filerobot-plugin/releases)
* 2\. Upload and unzip to the server at your domain path (Ex: /var/www/public\_html/)
* 3\. Configuration Commercetools & DAM plugin **(Read** [**2. Configuration**](#od_ebdb8e0c)**)**
* 4\. Go to the source folder and run "**npm install**", "**npm run build**" (this command will build and create a folder **public**)
* 5\. Go to the folder **public** and run "**pm2 serve --spa**".
* 6\. Config your domain, port you will run with Nginx and create SSL with Certbot [(Read here)](https://tecadmin.net/how-to-generate-lets-encrypt-ssl-using-certbot/) For example, config with port 8080:

<figure><img src="https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252F0Y9bUE0Ws3Vp09Y6ixWt%252Fct1.png%3Falt%3Dmedia%26token%3D56aa5580-e726-4b00-b1f2-a2c88947edcc&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=7ad33493&#x26;sv=1" alt=""><figcaption></figcaption></figure>

#### Step 2. Configure <a href="#od_ebdb8e0c" id="od_ebdb8e0c"></a>

* Get the **applicationId** and **entryPointUriPath** of Commercetools [(Read here)](https://docs.commercetools.com/custom-applications/development/going-to-production#assigning-the-application-id)

![](https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252FzqJ9pfQwApudAMti9bxm%252Fct2.png%3Falt%3Dmedia%26token%3D11ab7bcc-074c-4089-943c-db4f27249525\&width=768\&dpr=4\&quality=100\&sign=203b0cbb\&sv=1)![](https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252FifMNGsmYZRDBe0zgxC9n%252Fct3.png%3Falt%3Dmedia%26token%3D37051dac-7d40-4ae5-8d66-c2278c1d8bf7\&width=768\&dpr=4\&quality=100\&sign=57d18036\&sv=1)![](https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252F3mp1hpXFUsLEC7dmARZg%252Fct4.png%3Falt%3Dmedia%26token%3Df5cc186e-1576-4171-90c5-73af37f27cee\&width=768\&dpr=4\&quality=100\&sign=f32bed10\&sv=1)![](https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252FwRrod7XFb8Qmqfq1s62n%252F1.png%3Falt%3Dmedia%26token%3D6c61916b-2564-4cfd-a3ae-ae5d03cf95f7\&width=768\&dpr=4\&quality=100\&sign=3f28784d\&sv=1)

Configure the DAM module as follow:

<figure><img src="https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252FtyldFSrdskHCq2eW9AuI%252Fct8.png%3Falt%3Dmedia%26token%3Da105f3a3-f8a1-43b5-a500-428f5fddbb83&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=aa2b8798&#x26;sv=1" alt=""><figcaption></figcaption></figure>

* For Commercetools project:
  * Clone file **custom-application-config.example.mjs** and rename to **custom-application-config.mjs**
  * Input your Commercetools configuration
  * Set your **entryPointUriPath** at **src/constants.js**
* For the DAM module:
  * Clone file **filerobot-config.json.example** in folder "**src"** and rename to **filerobot-config.json**
  * Input your DAM token, SEC, upload directory, and any other options as fitting.

### User Guide <a href="#od_ef51fe98-2" id="od_ef51fe98-2"></a>

#### Access Scaleflex DAM <a href="#access-scaleflex-dam" id="access-scaleflex-dam"></a>

In left-menu, select **Scaleflex DAM** > **Products**

<figure><img src="https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252FS7JDhSywZtByHv51RKhg%252F2.png%3Falt%3Dmedia%26token%3D07cf6967-3f31-410d-bd60-b9e6673630dd&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=aedf94a8&#x26;sv=1" alt=""><figcaption></figcaption></figure>

#### Upload/Update Product Images <a href="#upload-update-product-images" id="upload-update-product-images"></a>

In this page select your product variant need to upload/update image

<figure><img src="https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252FBzSismUNUltmji8ALdpw%252F3.png%3Falt%3Dmedia%26token%3Dfb543f81-50f2-4ba9-964f-3af7294fc710&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=d5fcd352&#x26;sv=1" alt=""><figcaption></figcaption></figure>

To add new image, click on "Add Image" in view page Variant Detail

<figure><img src="https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252FBiVPkGd2NL46X5jsmyTD%252F4.png%3Falt%3Dmedia%26token%3Dd9500770-9b90-450e-87b0-8cfdbdca282b&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=b750a60c&#x26;sv=1" alt=""><figcaption></figcaption></figure>

Select an image on the widget and click on "Insert" button to add the image.

**Note:** You can select multiple images.

<figure><img src="https://docs.scaleflex.com/~gitbook/image?url=https%3A%2F%2F3586816136-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fl0Yvbyw1t10jWRzoi0FW%252Fuploads%252F24vMsC1mmqN0EzsKi2Bz%252F5.png%3Falt%3Dmedia%26token%3Dd46307b8-ac2b-4b9c-84a8-b5c8b160a552&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=6f23c54&#x26;sv=1" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scaleflex.com/digital-asset-management-dam/plugins-and-connectors/connectors/commercetools-faas-app.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
