OpenAI API Integration with MIP: A Step-by-Step Guide

MIP is a powerful and flexible integration platform that allows seamless connections with OpenAI APIs. In this guide, we will walk through the process of integrating MIP with OpenAI API step by step.

1. Creating a Package and Flow in MIP

First, we start by creating a package and flow in the MIP platform.

Creating a Package and Flow in MIP

Then open the integration flow. Click the button in the upper left corner to add a new flow configuration.

new flow configuration

2. Defining the OpenAI API Key

We define a variable to securely store the OpenAI API key:

  • Variable Name: openai_api_key
  • Description: The API key is required for OpenAI access.

This approach ensures that when moving from a test environment to production, we only need to update this variable’s value.

3. Configuring the Integration

After saving the configuration, we move to the design screen, where we are greeted by the Start Connector. This connector helps define the protocol that will trigger the integration.

  • Protocol: REST
  • Endpoint: The address where the integration will be provided.
  • Synchronous Option: If we expect synchronous responses from OpenAI, we must select Synchronous Endpoint.

4. Setting Up OpenAI API Requirements

a) Configuring Headers

Next, we add the Tools -> Transformations -> Set Context connector to define the HTTP headers required by the OpenAI API.

Configuring Headers
Configuring Headers2

b) Making API Calls Using HTTP Connector

Then, we add the Tools > External Calls -> Technology > HTTP connector to connect with OpenAI API.

  • HTTP Method: POST
  • Endpoint: The API URL provided by OpenAI
  • Timeout Setting: Since OpenAI requests can take time, we set a high timeout value.

You can find available endpoints under the Capabilities section in OpenAI Documentation.

c) Completing the Integration

To finalize the integration design, we add the End Connector. Once everything is set, click Save and Deploy.

Completing the Integration

5. Testing the Integration

To verify the integration, go to Operations > Endpoints and locate the endpoint URL we configured earlier.

Then, we use Postman to test the integration:

1. Create a new request.

2. Select POST as the method.

3. Enter MIP user credentials under the Authorization tab.

4. Paste the OpenAI request body in the Body section:

{
    “model”: “gpt-3.5-turbo”,
    “messages”: [
        {
            “role”: “developer”,
            “content”: “Convert today’s top 10 rising US stocks to XML format and provide only the XML content, no comments.”
        }
    ]

5. Send the request and examine the response from OpenAI.

Send the request and examine the response from OpenAI

6. Converting OpenAI Response to XML Format

To further improve our integration, let’s transform the OpenAI JSON response into XML format.

  1. Add a Set Context Connector.
  2. In the Context Properties tab, define a new variable to extract only the content field from the OpenAI JSON response.

 

Converting OpenAI Response to XML Format

3. Go to the Change Context tab and map this variable to the response.

go to the change context tab

4. Add a content-type header with application/xml in the Context Header section.

Context Header

When you test the integration again using Postman, you will now see an XML response.

Postman

7. Monitoring Integration Logs

To analyze the integration process in detail:

  1. Go to Operations > Endpoints and change the Log Level to All Steps.

 

Monitoring Integration Logs

2. Send another request via Postman.

3. Navigate to Monitoring > Message Monitoring to view integration messages.


Monitoring - Message Monitoring

4. Click on the number under the Successful column

5. In the latest message, click Action > Show Full Log.

This opens a new window displaying the integration design, allowing you to track each step of the process. For example, after receiving a response from OpenAI, you can see how the Set Context step modifies the output.

In this guide, we explored how to integrate MIP with OpenAI APIs and configure the necessary settings. If you have any questions, feel free to reach out!

Sedat Göç
MIP Team Lead

Similar Blog

OpenAI API Integration with MIP_ A Step-by-Step Guide (1)
  • Guide

OpenAI API Integration with MIP: A Step-by-Step Guide

MIP is a powerful and flexible integration platform that allows seamless connections with OpenAI APIs. In this guide, we will walk through the process of integrating MIP with OpenAI API step by step. 1. Creating a Package and Flow in MIP First, we start by creating a package and flow in the MIP platform. Then […]

Learn More
Most Common SAP Integration and Interface Methods   
  • Integration
  • SAP

Most Common SAP Integration and Interface Methods   

In our age of digitalisation, businesses have to integrate SAP systems with third-party applications used to manage business processes efficiently. At this point, the SAP Interface acts as a bridge that provides data flow between one or two SAP systems or between SAP and Non-SAP systems. These interfaces integrate different systems and transform data into […]

Learn More
SAP Integration with Non-SAP Systems
  • Integration

SAP Integration with Non-SAP Systems

In today’s business world, SAP systems are often the powerful tools of choice for large and complex data management and business processes. However, many companies not only use SAP solutions, but also incorporate various Non-SAP systems, applications and software into their business processes. At this point, SAP-SAP integration as well as integration with Non-SAP systems […]

Learn More
Important of SAP Integration with Third Party Applications
  • Integration

Important of SAP Integration with Third Party Applications

Today, many businesses use SAP ERP software to manage their operational processes and data. However, with the advancement of technology, the use of more than one application and software by enterprises has created situations where SAP alone cannot be sufficient. Therefore, integrating SAP with other applications and systems is of great importance for an efficient […]

Learn More
The Difference Between SOAP and REST
  • API

The Difference Between SOAP and REST

SOAP and REST are the most popular and widely used API approaches today.While both methods provide communication between different applications, they have significant differences. In this blog post, we will examine the differences between REST (Representational State Transfer) and SOAP (Simple Object Access Protocol) in detail. What is an API? API (Application Programming Interface) is […]

Learn More
Comparing Data Storage Solutions_ Data Warehouse, Data Lake, Data Lakehouse
  • Blog

Comparing Data Storage Solutions: Data Warehouse, Data Lake, Data Lakehouse

Today, businesses use multiple systems and software to manage decision-making processes more consciously, to provide better quality service to customers and to be successful. This software causes businesses to collect, transform, store and use more data than ever before. However, businesses need to be able to use this data in the best way. For this, […]

Learn More

Subscribe to our newsletter to dive integration world!

Join our exclusive newsletter community for insider tips, industry updates, and the latest trends in integration technology.