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.
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:
- Go to OpenAI.
- Select your username.
- Select View API Keys.
- Select Create New Security Key.
- Copy the newly-created API key.
To collect the Organization ID:
- Go to OpenAI.
- Select your user image.
- Select Manage Account.
- Select Settings.
- Copy your organization ID.
Collecting Commerce Manager Setup Information
Log in to Commerce Manager as a user with Seller Admin privileges.
Go to SYSTEM > Application Keys.
Select Create New.
Type a name for your application key.
Select Create.
Select Dismiss to view your application key.
To configure the integration, you need to copy the following values:
Commerce API Key Description API Base URL Your Commerce API Base URL. Client ID Your Commerce Client ID. Client Secret Your Commerce Client Secret.
See Creating an Application Key in Commerce Manager.
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.
- In Commerce Manager, go to COMPOSER > Integrations Hub.
- Under Product Information, click on the OpenAI Product Description Rewrite integration.
- Review the Overview page and click Configure. The Trigger details are displayed.
- Click Next.
- Configure the following information and click Finish.
Configuration parameter | Value |
---|---|
epcc_base_url | Your 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_id | Your Commerce API Client ID. |
epcc_client_secret | Your Commerce Client Secret. |
API Key | Your OpenAI connection API key. |
Organization | Your OpenAI connection organization ID. |
ai_instructions | The instructions that you want to use to rewrite your product descriptions. |
ai_model | Your AI model. |
Using the Integration
To rewrite a product description:
From the OpenAI Description Rewrite integration, select Test.
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.
Click Save & Run Test.
When the test has finished, go to your store to see your extended product descriptions.
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.