User struggling to set up OpenAI integration via Zapier on Plasmic

Hi Plasmic team, I have a question. Excuse me I’m a complete novice trying to figure things out.

I want to have a input box on a webpage, that is effectively the prompt for a ChatGPT assistant I have set up. In other words the text that the user inputs is simply sent to the CGPT assistant. I then want the response from the assistant to be passed back and displayed in a text box.

What steps are necessary to set up this integration?

Obviously there isn’t a native OpenAI integration but I see there is a Zapier integration. However when I go to the Zapier website to set up a ‘catch hook’ webhook, and I create the integration in Plasmic, it isn’t available to select as an integration.

https://www.loom.com/share/b7e669b74a19474b8d19527049d4b7dc

I would be grateful for a pointer in the right direction.

Hi Yasir, the Zapier integration is currently considered a “write only” so you can’t invoke it in the data queries, but if you go the button on click you should be able to call zapier from there, maybe a simpler way to set it up the assistant would be through the HTTP Api with the Open AI Assistant docs https://platform.openai.com/docs/assistants/how-it-works/managing-threads-and-messages , this may require some initial work to set up the knowledge base file outside of the studio, so that you can programmatically use the assistants api

But we should avoid showing Zapier as a creation option in that modal, as if you create there you won’t be able to use it, thanks for reporting it.

Thanks Felipe. I’ll try to have a go at setting it up with HTTP.

Felipe, hope you don’t mind if I ask you a few questions about the integration as I step through it.

Can you take a look and let me know if these settings look correct? My API key is blanked out for security.

Here is how I’m setting up my query. Content is set as the value of the input box named ‘input’.

SO many questions!
• Have i set it up the integration correctly?
• The ‘message’ parameter in OpenAI looks like an array (with ‘role’ and ‘content’ as items in the array). How do I set that up correctly as parameters in the data query?
• I need to see the response from OpenAI - how do I display the response in a text box?

I’m thinking the the response from OpenAI needs to be sent to an input box rather than a text box - is that correct?

If so, I think it would make sense to create a second Data Query for the response, and the content should be displayed in the input box. Also the input box should be disabled to prevent user entry in the response box. On the right track?

• Have i set it up the integration correctly?
Yes, it looks mostly right, I think you are still setting up from the Data Queries section, which I don’t it’s the expected, Data Queries are expected to be read operations but per OpenAI docs https://platform.openai.com/docs/api-reference/threads/createThread you need to do a POST request, it’s exposed in Plasmic through some in the interactions section.
I am sending some screenshots that may help. Also we have an app tutorial available in the dashboard that may be helpful to understand a bit of those concepts.

• The ‘message’ parameter in OpenAI looks like an array (with ‘role’ and ‘content’ as items in the array). How do I set that up correctly as parameters in the data query?
By using the green bold icon on top right of the body, you can pass an arbitrary content, you also can just write JSON in the input and should still work out.

• I need to see the response from OpenAI - how do I display the response in a text box?
If you are doing the POST request once it’s finished you can use another interaction to pass the result into a state. Then display the state in the UI with dynamic binding.

I’m thinking the the response from OpenAI needs to be sent to an input box rather than a text box - is that correct?
This is actually independent, you can send the response to anyplace in the UI.

I will be looking into building a basic GPT example this week, that will make more clear this things.

Thank you, I’m going to work through this but I am struggling. Have you given any thought to working with me on this project?

I will be looking into building a basic GPT example this week, that will make more clear this things.
That would be extremely helpful

I’ve switched to putting an interaction on the button, rather than a data query - makes sense.

I’ve set up the request as per the screenshot, but for some reason when I type the parameters out they don’t turn green like in your example.

If you are doing the POST request once it’s finished you can use another interaction to pass the result into a state. Then display the state in the UI with dynamic binding.
Is there a worked example that you can direct me to or a tutorial that would help me understand this?

I’m trying to get this to work as well, but I run into the same error. Any luck getting this to work @flowery_blackbird?

Did I set this up correctly @fmota? I tried to do the same as you did, but I’m still getting errors :thinking_face:

Hi, you can look into this thread https://plasmiccommunity.slack.com/archives/C0128PVPESU/p1704335778879849?thread_ts=1704326889.816449&cid=C0128PVPESU which has the same error