#Get info from assistant conversation and send to google sheets

1 messages · Page 1 of 1 (latest)

gleaming whale
#

@heavy bridge Hi everyone!

I am facing an issue. I am building an assistant (which I will later connect with Manychat) responsible for gathering information in a conversation, and I want this information to go into a Google Sheets spreadsheet.

The instructions for my assistant are to talk with the user until it obtains the following information: Name, phone number, product they want to buy, and payment method. Once the assistant has collected this information from the user, I want this information to be sent to a spreadsheet where I have these columns (name, phone number, etc.).

I am using Make for automations in this project, along with Manychat and OpenAI, so these tools are at my disposal.

Can someone help me, please?

heavy bridgeBOT
#

Hi @gleaming whale. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Sure, I can guide you on how you might approach this problem using the information from the provided knowledge sources.

Firstly, you would use the OpenAI API to interact with the user and collect the required information. You can set up a conversation with the user using the OpenAI API, as shown in the code snippet from this forum post (https://community.openai.com/t/867651). You can customize the assistant's instructions to guide the conversation towards collecting the user's name, phone number, product they want to buy, and payment method.

from openai import OpenAI
from config import db
import json

def assistant_ia(conversation):
    try:
        key = get_openai_key()
        openai_client = OpenAI(api_key=key)

        # Customize the assistant's instructions
        assistant_instructions = {
            "role": "system",
            "content": "You are my assistant. Your task is to collect the user's name, phone number, product they want to buy, and payment method."
        }

        conversation.insert(0, assistant_instructions)

        response = openai_client.chat.completions.create(
            model="gpt-3.5-turbo",
            messages=conversation,
            stream=True
        )

Once you have collected the required information, you would then need to send this data to your Google Sheets spreadsheet. While the OpenAI API can't directly manipulate software like Google Sheets, you can use the information provided by the API to manually create your spreadsheet or automate this process using a custom application, as explained in this forum post (https://community.openai.com/t/664565).

#

The actual creation of the files or direct manipulation of Google Sheets would need to be handled by your application's logic outside of the GPT API. You could use a programming language like Python to create a spreadsheet file using libraries such as pandas for data manipulation and gspread or pygsheets for Google Sheets manipulation.

Unfortunately, the provided knowledge sources do not contain specific information on how to use Make for automations or how to integrate this process with Manychat. You might need to refer to the documentation or community forums for these specific tools for more detailed guidance on these aspects.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: