Skip to main content

Integrating with OpenAI Product Description Rewrite

You can integrate Commerce with OpenAI quickly by adding your credentials and deploying the OpenAI Product Description Rewrite integration in Integrations Hub of Commerce Manager. Using the OpenAI Product Description Rewrite integration, you can rewrite your Commerce product descriptions. Using the instructions you provide, OpenAI drafts a new product description and adds it to an extended field on your product.

Collecting Your Setup Information

Before you begin configuring your integration in Commerce Manager, you need to collect the necessary setup information from OpenAI and Commerce Manager.

caution

Collect the following information and make sure you have it available, for example, in a text file, before configuring your integration in Commerce Manager. If you leave the Integration page in Commerce Manager, the integration is not saved and you must remove the integration and create a new one.

Collecting OpenAI Setup Information

You need to collect the API Key and Organization ID from OpenAI.

To collect the API Key:

  1. Go to OpenAI.
  2. Select your username.
  3. Select View API Keys.
  4. Select Create New Security Key.
  5. Copy the newly-created API key.

To collect the Organization ID:

  1. Go to OpenAI.
  2. Select your user image.
  3. Select Manage Account.
  4. Select Settings.
  5. Copy your organization ID.

Collecting Commerce Manager Setup Information

  1. Log in to Commerce Manager as a user with Seller Admin privileges.

  2. Go to SYSTEM > Application Keys.

  3. Select Create New.

  4. Type a name for your application key.

  5. Select Create.

  6. Select Dismiss to view your application key.

  7. To configure the integration, you need to copy the following values:

    Commerce API KeyDescription
    API Base URLYour Commerce API Base URL.
    Client IDYour Commerce Client ID.
    Client SecretYour Commerce Client Secret.

See Creating an Application Key in Commerce Manager.

note

When integrating with third-party providers, we recommend you use the closest region in the third-party service to reduce latency as much as possible. See Regions and URLs table.

Configuring the Integration

Now that you've collected the setup information, let's begin by configuring the integration.

  1. In Commerce Manager, go to COMPOSER > Integrations Hub.
  2. Under Product Information, click on the OpenAI Product Description Rewrite integration.
  3. Review the Overview page and click Configure. The Trigger details are displayed.
  4. Click Next.
  5. Configure the following information and click Finish.
Configuration parameterValue
epcc_base_urlYour Commerce API Token URL. For example, useast.api.elasticpath.com/oauth/access_token (EU) or useast.api.elasticpath.com/oauth/access_token (US). See Regions and URLs.
epcc_client_idYour Commerce API Client ID.
epcc_client_secretYour Commerce Client Secret.
API KeyYour OpenAI connection API key.
OrganizationYour OpenAI connection organization ID.
ai_instructionsThe instructions that you want to use to rewrite your product descriptions.
ai_modelYour AI model.

Using the Integration

To rewrite a product description:

  1. From the OpenAI Description Rewrite integration, select Test.

  2. In Payload body, enter the product ID of the products whose description you want to update. You can only rewrite one product's description at a time.

     {
    "product": {
    "product_id": "b8e9af84-69f9-472c-ad18-57557e1d2c75"
    }
    }

    You can get a product's ID from the Products page in Commerce Manager or using the Get all Products endpoint.

  3. Click Save & Run Test.

  4. When the test has finished, go to your store to see your extended product descriptions.

  5. To rewrite the product description of another product, amend the ai_instructions, add a new product ID to the Payload body and run Test again.