# Transformers Installation

**Cognigy Support**  
March 4, 2021

In order to use a transformer function, one has to follow a few steps in the Help Center and Cognigy.AI. Since there are two different types of transformer functions in Cognigy.AI, namely **Endpoint** and **NLU**, this guide is separated into two parts.

## Install an Endpoint Transformer

1. Open the [Transformers Overview](https://support.cognigy.com/hc/en-us/articles/360019704899) page  
2. Click on **Download** for the wanted Endpoint Transformer:

### Import / Upload Transformer to Cognigy.AI Endpoint

1. Open the recently downloaded transformer function in a preferred text editor (e.g. Visual Studio Code)  
2. _Optional: Adjust the code for your needs_  
3. Copy the entire code to the clipboard (STRG + A -> STRG + C)  
4. Login to Cognigy.AI  
5. Navigate to `Deploy -> Endpoints -> Your Endpoint`
   1. _In this case, we use a REST Endpoint for WhatsApp_  
6. Scroll down to the **Transformer Functions** section and open it  
7. Now paste the previously copied code into the black code field:

### Transformer Settings

Based on the used functions in the transformer, one needs to enable various Transformer Settings:

- Abort on Error in Transformer  
  - Enable this, if the code should abort the execution when an error occurs
- Enable Input Transformer  
  - Enable this, if the `handleInput()` function is filled with custom code
- Enable Output Transformer  
  - Enable this, if the `handleOutput()` function is filled with custom code
- Enable Execution Finished Transformer  
  - Enable this, if the `executionFinished()` function is filled with custom code

After pasting and enabling the required functions, the Endpoint Transformer can be used. In this example case, one could use Tyntec in order to provide WhatsApp as a channel. [Please find more information about WhatsApp here.](https://support.cognigy.com/hc/en-us/articles/360016717640)

## Install an NLU Transformer

1. Open the [Transformers Overview](https://support.cognigy.com/hc/en-us/articles/360019704899) page  
2. Click on **Download** for the wanted NLU Transformer:

### Import / Upload Transformer to Cognigy.AI Endpoint

1. Open the recently downloaded transformer function in a preferred text editor (e.g. Visual Studio Code)  
2. _Optional: Adjust the code for your needs_  
3. Copy the entire code to the clipboard (STRG + A -> STRG + C)  
4. Login to Cognigy.AI  
5. Navigate to `Deploy -> Build-> NLU Connectors`
   1. _In this case, we use a REST Endpoint for WhatsApp_  
6. Create a new **Code NLU Connector**:
   
   
7. Click on the recently created NLU Connector  
8. Expand the **Transformer Functions** section  
9. Now paste the previously copied code into the black code field:

### Transformer Settings

Based on the used functions in the transformer, one needs to enable various Transformer Settings:

- Abort on Error in Transformer  
  - Enable this, if the code should abort the execution when an error occurs
- Enable Code Transformer  
  - Enable this, if the `handleInput()` function is filled with custom code
- Debug Transformer Stack  
  - Enable this, if the transformer stack should be exposed to the [interaction panel](https://docs.cognigy.com/docs/interaction-panel) (Test Chat)

After pasting and enabling the required functions, the NLU Transformer can be used.
