# Connect ChatGPT with WhatsApp in BizMagnets Chatbot

## **Overview**&#x20;

Enhance your conversational AI with the Open AI connector. This guide walks you through the seamless integration process, allowing you to choose actions like Create Completion and Chat Completion for a tailored Open AI experience.

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2FbML7vfZHmztL02wlzZVy%2FScreenshot%202025-09-18%20162713.png?alt=media&#x26;token=09e2953c-6bc6-4478-8cab-c219939c5cff" alt=""><figcaption></figcaption></figure>

## Connect Open AI&#x20;

1. To begin, navigate to the Integrations section and click on Open AI.
2. After clicking on Open AI Connector, you will be prompted to either Add New Connection or Select Existing Connection. If you haven’t created a connection yet, review the Connection Name and proceed by pasting your API Key. You will find the guide to find the key [here](https://platform.openai.com/docs/api-reference/authentication).

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2FB1q4NuX0pWqwg7UdsrvC%2FScreenshot%202024-10-11%20140334.png?alt=media&#x26;token=df9e0b5d-7c28-4e49-884a-adeb6aa72e5a" alt=""><figcaption></figcaption></figure>

3. Once you've entered the Connection name and API Key, click Create Connection.

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2FcWqCNAjAVRqVckL3zOQA%2FScreenshot%202024-10-11%20140346.png?alt=media&#x26;token=e34a17ed-da58-4492-b8ee-3558132ae5df" alt=""><figcaption></figcaption></figure>

4. If the Open AI connection is already set up, simply choose Select Existing Connection and click Connect.

## Using Open AI Connector

1. Once the connection is created, click Connect next to the connection to start configuring the connector, which will take you to the selected action.

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2FkPCl6HaRYtdSwz5IxSt1%2FScreenshot%202024-10-11%20140903.png?alt=media&#x26;token=8eecfe60-0608-4377-9381-308c643acb2f" alt=""><figcaption></figcaption></figure>

2. After connecting, the selected action, Chat Completion, will open, and you'll need to configure fields such as Context, User Prompt, Model, Knowledge Base, Max Tokens, Temperature, and the variable.

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2F17PcY4oC6zp1hKVydybv%2FScreenshot%202024-10-11%20141057.png?alt=media&#x26;token=f6140690-0645-4c13-a843-19baa93134f0" alt=""><figcaption></figcaption></figure>

3. For the Context, you can use the following example: "If the Intent is either Feedbacks, Products, Product, Register, Hi, Main Menu, match the user input to the correct intent and return the intent as it is. If it doesn't match, return the default intent."

{% hint style="info" %}
You can modify the intents according to your bot, but keep the rest of the context the same for the card to function properly. For example: "If the Intent is either Intent 1, Intent 2, Intent 3, Intent 4, Intent 5, Intent 6, match the user input to the correct intent and return the intent. If it doesn't match, return the default intent."
{% endhint %}

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2FhtdkxVmLqbIjJClWfZES%2FScreenshot%202024-10-11%20141707.png?alt=media&#x26;token=c2fe5c07-9d5d-418e-aad6-019c827f0dae" alt=""><figcaption></figcaption></figure>

4. In the User Prompt field, add the variable as {{intent.text}}.

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2FA7m0sQstOuGU0u61ZdoG%2FScreenshot%202024-10-11%20141529.png?alt=media&#x26;token=a236ec09-68a2-4979-af1d-9df216d7d50e" alt=""><figcaption></figcaption></figure>

5. For the Model, there is only one option available for the Chat Completion action that you need to select.

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2FFr8np4e5lOcSXLopfMrs%2FScreenshot%202024-10-11%20141600.png?alt=media&#x26;token=ca6ccead-eb1c-4ce6-a5f8-dc2cd66adbd4" alt=""><figcaption></figcaption></figure>

6. Select the knowledge Base from the dropdown menu.&#x20;

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2FG2Xe7a8HwO7jlvJ67LTk%2FScreenshot%202024-10-11%20142100.png?alt=media&#x26;token=68239a72-4c91-431f-b6d6-547747332278" alt=""><figcaption></figcaption></figure>

6. Tokens represent pieces of words, and their length can be described as:

* 1 token ≈ 4 characters in English
* 1 token ≈ ¾ of a word
* 100 tokens ≈ 75 words
* 1-2 sentences ≈ 30 tokens
* 1 paragraph ≈ 100 tokens
* 1,500 words ≈ 2,048 tokens

Learn more about tokens [here](https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them).

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2FoJ83xY4ZopQi1nbTzJVj%2FScreenshot%202024-10-11%20142335.png?alt=media&#x26;token=c87d7500-ca81-4449-8604-fa165e2c33f6" alt=""><figcaption></figcaption></figure>

7. Sampling temperature controls the randomness of the text generated by Open AI. A higher temperature (e.g., 0.8) leads to more diverse and creative output, while a lower temperature (e.g., 0.2) makes the output more focused and deterministic.

The default temperature in Open AI is set to 0.8, which offers a good balance between creativity and consistency. You can experiment with different temperature settings to suit your needs.

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2FGaiJ8wESY7wZKQV9p1aI%2FScreenshot%202024-10-11%20142430.png?alt=media&#x26;token=9a835d91-0230-45e9-b92c-3726ff70a780" alt=""><figcaption></figcaption></figure>

8. You also need to create or select a variable to store the AI's response.

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2FbCqeDHJKLRiOndlkGAqh%2FScreenshot%202024-10-11%20142628.png?alt=media&#x26;token=dd0e57d9-f914-46fa-9065-4888d4841d7e" alt=""><figcaption></figcaption></figure>

9. Once you’ve filled in the values for all fields in the action, click Save.

In BizMagnets bot-builder, the card will appear as shown in the picture below. The green and red marks represent the success and failure conditions.

<figure><img src="https://789614814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvCr7uCTpZRGEF8A48OOJ%2Fuploads%2F0UCBU5pAV5IRrRgtLeSJ%2FScreenshot%202024-10-11%20142750.png?alt=media&#x26;token=ac9aa6e6-7c53-46fb-92e5-223ee71c537d" alt=""><figcaption></figcaption></figure>

Maximize the potential of your Open AI connector by carefully configuring actions like Chat Completion. Tailor the context, user prompts, model selection, and temperature settings to create a smooth and enriched conversational flow. With success and failure conditions visually depicted in BizMagnets bot-builder, you’re set to harness the power of AI in your chat-flow.&#x20;
