Best way to trigger GPT response on Enter key, save chat, and clear input (non-coder, 2 weeks stuck)

Hey Bubble community :waving_hand:

I’m building a chat app using OpenAIAPI. I’ve spent over 2 weeks trying to get one key interaction working cleanly and I’m stuck. I’m not a coder — just trying to get this done using plugins + workflows.

**What I’m trying to do

When a user types into a multiline input and presses Enter, I want to:

  1. Save their message to a ChatHistory datatype (with sender/session)
  2. Trigger a custom GPT-4 API call that responds
  3. Save that GPT response to the same session
  4. Clear the input so they can type the next message

:cross_mark: What’s going wrong:

I’ve tried multiple methods and plugins, including:

  • AirKeyboardShortcuts (with Allow globally enabled)
  • Enter to Submit Multiline Input
  • Using custom states to temporarily store the message
  • Adding a pause before triggering my GPT logic

But if I hit Enter too fast, only the first character gets saved (e.g., “t” instead of “test”). The GPT call runs and responds — but it’s based on an incomplete message.


:wrench: Setup overview:

  • Multiline input ID: chat_input
  • Send button ID: askSylaraBtn
  • AirKeyboardShortcuts listens for Enter and simulates a click on the send button
  • My GPT API is called via Run_Chatbot_Logic (custom event)
  • I’ve tried delays, resets, manual value setting — still buggy

:folded_hands: Ask:

What is the most stable, no-code-friendly way to:

  • Detect Enter key on a multiline input
  • Save the full input text (not partial)
  • Trigger an API workflow
  • And clear the input afterward?

Is there a better plugin for this? Or a known fix to the timing issue?

Really appreciate any help — happy to DM if it helps. Thanks in advance :raising_hands:


Have you tried this one though?

Should work as you need it.

Thanks GH5T - I ended up paying and it does run smoother than the air keyboard I’ll give it that - something im having trouble is when the enter button is hit it wont clear the multiline input field - any suggestions? I tried ‘reset relevant inputs’ but it doesnt capture fast enough or it doesnt render. Only hide and show has worked. This is my workflow

So, the reset functionality will work when you have the button inside the same group as the multi-line input.

I could add a reset function, but i dont think it’s necessary.

Multi-line input wrapped w/ button:

Action:

Just make sure it’s wrapped, and when you have your resetting functionality occur, use the Reset “x Group” action. Should work as you need.

So i do have it in a group - and ive tried reset chat_input but still it doesnt - im contemplating maybe creating an animation before and after to show ‘chatbot thinkin…’ or something along those lines - what do you think? Appreciate all the help I’ve only been attempting to develop for a month now but slowly getting better with chatgpt as an assistant

1 Like

Well, I tried it with your method, and it doesn’t work as expected… so I made a reset function that will work with it globally, rather than it depending on an element inside the group to trigger it.

Just refresh your plugins, and the update should show up!

Enjoy :slight_smile:

cant believe i got to the developer - thanks man! its still not working but I feel I can get it - when you did it was it able to clear the multiline? this is the set up and i also tried adding reset relavent inputs after


one additional clarification - im using the attribute id and multiline id as a dynamic ‘ask sylara’s in putid’ i dont know if its the variable id’s im screwing up but everything else works.

Your multi-line input’s ID should never change.

The reset functionality will work correctly if you use it with shift-enter now, just pushed another update.

INSTRUCTIONS FOR USE:

MULTI-LINE INPUT (ATTACH ID)
INPUT-TRIGGER ELEMENT (ASSIGN MULTI-LINE ID TO IT)

Now, your actions would be as follows:

Enter is pressed > Your workflows > Reset Input Trigger

EDIT:

If you’re trying to have a multi-line input for each “message”, then use the message unique ID as your dynamic ID variable, like so: “input-[dynamic-id]”. So that way, you can have many multi-like inputs with the same functionality. Just be sure to use the “Input Trigger” element inside of your repeating group.

Still having trouble with the clearing - I know the attribute ID’s are working they are both linked to the button and the chatbot is functioning when i go in the debugger it clears but when i launch and preview it does not clear

  • For input triggerA - I have Multi LINE ID - Same multiline-inputID (the custom state) - ID Attribute is empty. then trigger → work flow → reset trigger still having trouble sorry

DM me an editor link. I can have a gander.

Link dm’d

almost there - just trying to ensure it captures everything in the multiline input for a fast typer

1 Like

I spoke too soon - so its perfect on mobile (i was testing it this morning on the fly) - but on the computer i type pretty fast (100wpm?) lets say average key stroke is 60wpm - its still not capturing. Could we extend the built in lag or whatever is capturing

Fyi I did, uninstall and reinstall the plugin - i also deleted and recreated the workflow and tested on my mobile vs desktop again

Tip: to reset an input with “reset relevant input” in you don t use the input value in that workflow, add in action “resetrelevant input” condition : “when input xyz’s vlue is not empty”

Found this on the forum and it is pretty usefull!

1 Like