> 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`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# GenerateText

# Package: socialMedia

# Namespace: GeneratedContentService

# Method link: https://dev.wix.com/docs/api-reference/business-management/marketing/social-media/generated-content-v1/generate-text.md

## Permission Scopes:
Manage Social Posts: SCOPE.PROMOTE.MANAGE-SOCIAL-POSTS

## Introduction

Generates post captions from a text prompt.

Returns suggested captions that you can add to an item's content.

---

## REST API

### Schema

```
 Method: generateText
 Description: Generates post captions from a text prompt.  Returns suggested captions that you can add to an item's content.
 URL: https://www.wixapis.com/social-publisher/v1/generate-text
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  userInput
 Method parameters: 
   param name: additionalContent | type: AdditionalContent    
        - name: url | type: string | description: URL to reference in the captions, such as a link to promote.  | validation: format WEB_URL
        - name: withHashtags | type: boolean | description: Whether to include hashtags in the captions.  
        - name: addLinkInBio | type: boolean | description: Whether to add a "link in bio" reference to the captions.  
   param name: channelName | type: ChannelName | description: Supported social channel.  
      - enum:
           INSTAGRAM - 
           FACEBOOK - 
           YOUTUBE - 
           LINKEDIN - 
           TWITTER - 
           PINTEREST - 
           GBP - Google Business Profile.
           TIKTOK - 
   param name: languageCode | type: languageCode | description: 2-letter language code for the generated captions in ISO 639-1 alpha-2 format.  | validation: maxLength 2
   param name: tone | type: tone | description: Tone of voice for the captions. For example, `professional` or `playful`.  | validation: maxLength 30
   param name: userInput | type: userInput | description: Text prompt describing the post to generate captions for. | required: true | validation: maxLength 3000
 Return type: GenerateTextResponse
  - name: results | type: array<GenerateTextResult> | description: Generated caption suggestions.  
     - name: caption | type: string | description: Generated caption.  | validation: maxLength 1000
     - name: title | type: string | description: Generated title.  | validation: maxLength 1000


```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.promoteGrowthToolsPublisher.generatedContent.generateText(userInput, options)
 Description: Generates post captions from a text prompt.  Returns suggested captions that you can add to an item's content.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  userInput
 Method parameters: 
   param name: options | type: GenerateTextOptions  none  
        - name: channelName | type: ChannelName | description: Social channel to tailor the captions for.  
             - enum: INSTAGRAM, FACEBOOK, YOUTUBE, LINKEDIN, TWITTER, PINTEREST, GBP, TIKTOK
        - name: tone | type: string | description: Tone of voice for the captions. For example, `professional` or `playful`.  | validation: maxLength 30
        - name: languageCode | type: string | description: 2-letter language code for the generated captions in ISO 639-1 alpha-2 format.  | validation: maxLength 2
        - name: additionalContent | type: AdditionalContent | description: Additional content to incorporate into the captions.  
           - name: url | type: string | description: URL to reference in the captions, such as a link to promote.  | validation: format WEB_URL
           - name: withHashtags | type: boolean | description: Whether to include hashtags in the captions.  
           - name: addLinkInBio | type: boolean | description: Whether to add a "link in bio" reference to the captions.  
   param name: userInput | type: string | description: Text prompt describing the post to generate captions for. | required: true | validation: maxLength 3000
 Return type: PROMISE<GenerateTextResponse>
  - name: results | type: array<GenerateTextResult> | description: Generated caption suggestions.  
     - name: caption | type: string | description: Generated caption.  | validation: maxLength 1000
     - name: title | type: string | description: Generated title.  | validation: maxLength 1000


```

### Examples

### generateText
```javascript
import { generatedContent } from '@wix/promote-growth-tools-publisher';

async function generateText(userInput,options) {
  const response = await generatedContent.generateText(userInput,options);
};
```

### generateText (with elevated permissions)
```javascript
import { generatedContent } from '@wix/promote-growth-tools-publisher';
import { auth } from '@wix/essentials';

async function myGenerateTextMethod(userInput,options) {
  const elevatedGenerateText = auth.elevate(generatedContent.generateText);
  const response = await elevatedGenerateText(userInput,options);
}
```

### generateText (self-hosted)
Self-hosted 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 { generatedContent } from '@wix/promote-growth-tools-publisher';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function generateText(userInput,options) {
  const response = await myWixClient.generatedContent.generateText(userInput,options);
};
```

---