> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# GenerateInputMappingFromIntent

# Package: actions

# Namespace: ActionCatalogService

# Method link: https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-catalog/generate-input-mapping-from-intent.md

## Permission Scopes:
Set Up Automations: SCOPE.CRM.SETUP-AUTOMATIONS

## Introduction

Generates an action's input mapping from a natural language description of the desired configuration.

---

## REST API

### Schema

```
 Method: generateInputMappingFromIntent
 Description: Generates an action's input mapping from a natural language description of the desired configuration.
 URL: https://www.wixapis.com/v1/actions/generate-input-mapping-from-intent
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  appId, actionKey, intent, conversationId, actionSchema
 Method parameters: 
   param name: actionKey | type: actionKey | description: Action key.  Learn about [adding an action to your app](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | required: true | validation: minLength 5, maxLength 100
   param name: actionSchema | type: actionSchema | description: Accumulated schema for the action, used to inform the generation. | required: true 
   param name: appId | type: appId | description: GUID of the app that defines the action. | required: true | validation: format GUID
   param name: conversationId | type: conversationId | description: Conversation GUID, used to maintain context across multiple requests in the same conversation with the calling agent. | required: true | validation: minLength 1, maxLength 256
   param name: intent | type: intent | description: Natural language description of the desired action configuration. | required: true | validation: minLength 1, maxLength 10000
 Return type: GenerateInputMappingFromIntentResponse
  - ONE-OF: 
     - name: inputMappingGeneratedInfo | type: InputMappingGeneratedInfo | description: Returned when an input mapping was generated successfully.  
        - name: inputMapping | type: object | description: Generated input mapping, conforming to the action's input schema.  
     - name: additionalInformationRequiredInfo | type: AdditionalInformationRequiredInfo | description: Returned when the intent doesn't contain enough information to generate the input mapping.  
        - name: feedback | type: string | description: Feedback for the calling agent describing what additional information is needed to refine the intent.  | validation: minLength 1, maxLength 10000
  - name: status | type: Status | description: Status of the generation.  
     - enum:
     -     INPUT_MAPPING_GENERATED: Input mapping was generated successfully.
     -     ADDITIONAL_INFORMATION_REQUIRED: Intent doesn't contain enough information to generate the input mapping.

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: EMPTY_INTENT | Description: The intent is empty or contains only whitespace.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: ACTION_SPI_NOT_FOUND | Description: The requested action does not have a matching service plugin implementer.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: GENERATE_INPUT_MAPPING_FROM_INTENT_NOT_IMPLEMENTED | Description: The action provider does not implement intent-based input mapping generation.


```

### Examples

### Generate input mapping from intent
```curl
curl -X POST 'https://www.wixapis.com/v1/actions/generate-input-mapping-from-intent' \
    -H 'Authorization: <AUTH>' \
    -H 'Content-Type: application/json' \
    -d '{
      "appId": "e4c3e640-0b63-4bd9-8574-53f8c14e0236",
      "actionKey": "send-gift-card",
      "intent": "Send a $25 gift card to the contact who triggered the automation",
      "conversationId": "f8e7d6c5-b4a3-2190-8765-4321fedcba09",
      "actionSchema": {
        "type": "object",
        "properties": {
          "contactId": {
            "type": "string",
            "format": "uuid",
            "title": "Contact ID"
          },
          "amount": {
            "type": "number",
            "title": "Gift card amount"
          }
        }
      }
    }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.automations.actionCatalog.generateInputMappingFromIntent(appId, options)
 Description: Generates an action's input mapping from a natural language description of the desired configuration.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  appId, options.actionKey, options.intent, options.conversationId, options.actionSchema, options
 Method parameters: 
   param name: appId | type: string | description: GUID of the app that defines the action. | required: true | validation: format GUID
   param name: options | type: GenerateInputMappingFromIntentOptions  none | required: true 
        - name: actionKey | type: string | description: Action key.  Learn about [adding an action to your app](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | required: true | validation: minLength 5, maxLength 100
        - name: intent | type: string | description: Natural language description of the desired action configuration. | required: true | validation: minLength 1, maxLength 10000
        - name: conversationId | type: string | description: Conversation GUID, used to maintain context across multiple requests in the same conversation with the calling agent. | required: true | validation: minLength 1, maxLength 256
        - name: actionSchema | type: object | description: Accumulated schema for the action, used to inform the generation. | required: true 
 Return type: PROMISE<GenerateInputMappingFromIntentResponse>
  - ONE-OF: 
     - name: inputMappingGeneratedInfo | type: InputMappingGeneratedInfo | description: Returned when an input mapping was generated successfully.  
        - name: inputMapping | type: object | description: Generated input mapping, conforming to the action's input schema.  
     - name: additionalInformationRequiredInfo | type: AdditionalInformationRequiredInfo | description: Returned when the intent doesn't contain enough information to generate the input mapping.  
        - name: feedback | type: string | description: Feedback for the calling agent describing what additional information is needed to refine the intent.  | validation: minLength 1, maxLength 10000
  - name: status | type: Status | description: Status of the generation.  
     - enum:
     -     INPUT_MAPPING_GENERATED: Input mapping was generated successfully.
     -     ADDITIONAL_INFORMATION_REQUIRED: Intent doesn't contain enough information to generate the input mapping.

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: EMPTY_INTENT | Description: The intent is empty or contains only whitespace.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: ACTION_SPI_NOT_FOUND | Description: The requested action does not have a matching service plugin implementer.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: GENERATE_INPUT_MAPPING_FROM_INTENT_NOT_IMPLEMENTED | Description: The action provider does not implement intent-based input mapping generation.


```

### Examples

### Generate input mapping from intent
Generates an action's input mapping from a natural language description.

```javascript
import { actionCatalog } from "@wix/automations";

async function generateInputMappingFromIntent() {
  const response = await actionCatalog.generateInputMappingFromIntent({
    appId: "e4c3e640-0b63-4bd9-8574-53f8c14e0236",
    actionKey: "send-gift-card",
    intent: "Send a $25 gift card to the contact who triggered the automation",
    conversationId: "f8e7d6c5-b4a3-2190-8765-4321fedcba09",
    actionSchema: {
      type: "object",
      properties: {
        contactId: { type: "string", format: "uuid", title: "Contact ID" },
        amount: { type: "number", title: "Gift card amount" },
      },
    },
  });
  return response;
}

/* Promise resolves to:
 * {
 *   "status": "INPUT_MAPPING_GENERATED",
 *   "inputMappingGeneratedInfo": {
 *     "inputMapping": {
 *       "contactId": "{{var(\"contact.id\")}}",
 *       "amount": 25
 *     }
 *   }
 * }
 */

```

### generateInputMappingFromIntent (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { actionCatalog } from '@wix/automations';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { actionCatalog },
  // Include the auth strategy and host as relevant
});


async function generateInputMappingFromIntent(appId,options) {
  const response = await myWixClient.actionCatalog.generateInputMappingFromIntent(appId,options);
};
```

---