Please wait
Talk to Expert
Microsoft Dynamics Business central

Integration Between Chat GPT & Business Central.

Configure Business Central Container in Docker. 01

The integration between ChatGPT and Business Central could involve leveraging ChatGPT’s conversational capabilities to interact with and query data from Business Central, as well as using Business Central’s APIs to perform actions or retrieve information based on user inputs from ChatGPT.

what is Chat GPT?

 

Chat GPT is a natural language processing tool driven by AI technology that allows you to have human-like conversations and much more with a chatbot. The language model can answer questions, and assist you with tasks such as composing emails, essays, and code. Usage is currently open to the public free of charge because Chat GPT is in its research and feedback-collection phase. As of Feb. 1, there is also a Paid Subscription Version Called Chat GPT Plus.

 

Integrate Chat GPT with Business Central, Step By Step:

 

Step 1

First of all create an account for using Chat GPT on Open AI.

You can Register on open AI using below Link.

Register on Open AI.

After filling in All the Details your OPEN AI Account will be created. We need this account to get some Details to access Chat GPT like API KEY & Organization ID.

 

Step 2

Now to get the API KEY click on your Profile and then select View API KEY.

As you can see in below image.

As you can see there Is one Secret Key which is our API KEY.

 

Step 3

To integrate Chat GPT & Business Central. We need Organization ID. For that Click on Setting As you can see in below Image.

 

Step 4

Now let’s create one table for OPEN AI SETUP and add five fields in this Table. As you can see in below image.

 

Step 5

Also create one card page for that.

 

 

Step 6

Create one more page to ask Questions and show that’s answer. So, add two fields In two different groups and this page have no source table. As per the below image.

 

We are using some page properties like:

  1. Delete Allowed
  2. Insert Allowed

and also use some fields properties like:

  1. Multi-Line
  2. Show Caption.

 

 

Step 7

Now add one action on this page end This action is for send request to Open AI and get a response from Open AI. As you can see in below Image.

 

This variable is for our fields, because we are not using any source table for this page.

 

Step 8

Create one CODEUNIT contacting with OPEN AI. Now create one This is our main procedure. We are calling many Procedures in this. As you can see in below Image.

 

Step 9

Now create one Local Procedure for Set Body. This procedure is to Check Inserted Details like our API KEY, Organization ID, Mix Token and temperature.  and If Al provided Details are correct then we get response other wise get error. As you can see in below image.

 

Step 10

Now create one Local Procedure for Set Body. This procedure is for set header and authorize values and store responses. As you can see in below image.

 

Step 11

Now create one Local Procedure for This procedure is to send our request to the Server. Check our Details and if all are correct then request send if find any mistake or issues then give error. As you can see in below Image. As you can see in below Image.

 

Step 12

Now create one Local Procedure for Read Response. This procedure is for read response form server and show us in JSON format. As you can see in below image

 

Step 13

Now create one Local Procedure for Send Default Requests. This procedure get our Details (Like API KEY, Organization ID, Mix Token) form Open AI Set up Page and send Requests to the server. As you can see in below Image.

 

Step 14

Now we are creating some other procedures for show responses in text format, authentication(Checking API KEY), etc. Basically, these procedures are used for checking or assign Data.

 

Step 15

Now, these are some global variables that we are used in this Code unit.

 

We already called this action on our ASK GPT Card Page which can see in Image 8.

 

Step 16

Now published extension and then OPEN AI SETUP page.

Insert these all Details in the fields.

  1. Organization ID (Get from OPEN AI App. Image No. 4)
  2. API Key (Get from OPEN AI App. Image No. 3)
  3. Default Max Token (1000)
  4. Default Temperature (0.9)

As you can see in below image.

 

Step 17

Now open the ASK GPT Card Page and type your Question or Query in the Request Section and then click on SEND Action. As you can see in below image.

 

Step 18

Now our code unit send request to the server and get a response from the server and show in the Response Section

We passed a request for How to Create Sales Order in Business Central?

and we get this solution in response from the serverAs you can see in below Image.

 

If any mistake or wrong details provided, then server throws an error in JSON format.

 

Thank you for investing your time to read our blog! We’re passionate about sharing valuable insights to help you navigate the world of Business Central.

If you’re curious about how we can assist you in reaching your goals, don’t hesitate to get in touch. Our dedicated team is ready to provide support every step of the way.

Let’s turn your vision into reality together!


Comments