I'm using Webflow for my frontend, and the callin.io scenario is set up like this:
Webhook + OpenAI (Chat Completion) + Webhook Response
Although the callin.io scenario runs perfectly, I'm not receiving the output on my Webflow site. Here are the custom codes I've implemented in Webflow:
Could someone please help me fix this? Every time I run the scenario, it displays "accepted" on the website instead of the actual response.
Welcome to the callin.io community!
We can’t see your code in your post body as it appears to contain some HTML tags.
1. Format your code
Could you please format your code by enclosing it within three backticks (```) before and after the code, like this:
<sup>_input/output bundle goes here_</sup>
or by using the format code button in the editor:
2. Webflow site links
Can you please provide the project preview/share link AND the published page link for your site?
3. Scenario blueprint
Please export the scenario blueprint file so others can review the mappings and settings. You can find the Export Blueprint option by clicking the three dots at the bottom of the scenario editor.
(Note: Exporting your scenario will not include private information or connection keys)
Uploading it here will display as follows:
blueprint.json (12.3 KB)
4. And most importantly, Output bundles
Please provide the output bundles for the modules. To do this, run the scenario, then click the white speech bubble on the top-right of each module. Save the bundle contents to a bundle.json
file and upload it to this discussion thread.
Providing the output bundles will enable others to replicate the scenario's behavior, even if they don't use the external service.
Following these steps will help others assist you. Thanks!
- Here are the code snippets:
<script>
// Select the form element and the loader elements
const form = document.querySelector('#wf-form-generator');
const resultWrap = document.querySelector('#statement-component');
const resultLoader = document.querySelector('#statement-loader');
const resultText = document.querySelector('#statement-text');
// Add a submit event listener to the form
form.addEventListener('submit', (event) => {
// Prevent the default form submission behavior
event.preventDefault();
// Show the div that will contain the response and scroll to it
resultWrap.style.display = "block";
resultLoader.style.display = "flex";
resultWrap.scrollIntoView({behavior: "smooth"});
// Get the values of the form fields
const income = document.getElementById('income').value;
const debt = document.getElementById('debt').value;
const monthlysavings = document.getElementById('monthlysavings').value;
const risktolerance = document.getElementById('risktolerance').value;
const anynote = document.getElementById('anynote').value;
const profession = document.getElementById('profession').value;
const age = document.getElementById('age').value;
// Create the prompt string using the form field values
const prompt = `Generate an investment stratgey for an Indian who's profession is ${profession}, age is ${age} and income is ${income}. Their monthly savings are ${monthlysavings} and risk tolerance is ${risktolerance}. Keep in mind ${anynote}. The output should be in similar format : Sensex or nifty ₹1000, any individual high performing stocks ₹200, Gold ₹100, Silver ₹50 and mutual funds smalll cap, medium cap and large cap ₹500 etc. Note that these amounts should add upto the amount of ${monthlysavings}.`;
// Make an API call to our callin.io scenario
fetch('https://hook.eu2.make.com/7ruo5nlopv8cos93xx6bpqcw9mqnxwdu', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
prompt: prompt,
max_tokens: 512
})
})
// Then get the API response object, covert it to text and display it
.then(response => response.text())
.then(result => {
resultText.value = result;
resultLoader.style.display = "none";
});
});
</script>
blueprint.json (13.6 KB)
- The output bundle displays "none".
Thank you for your reply. I look forward to your response.
It appears to be functioning on your end. Is the issue related to the OpenAI module?
Kindly review the scenario's execution history and check the webhook response.
Please provide the following details:
To help diagnose the issue, please share the output bundles from the ChatGPT module. You can do this by navigating to the latest execution, clicking the white speech bubble in the top-right corner of the module, and saving the bundle contents as a bundle.json
file. Then, upload this file to this discussion thread.
Sharing the output bundles will enable others to replicate the scenario's behavior, even if they don't use the same external service.
Following these instructions will greatly assist others in helping you. Thank you!
Occasionally, a timeout error appears in "History," but the callin.io scenario otherwise completes successfully.
Below are the output bundles from the OpenAI module.
bundles.json (2.1 KB)
I look forward to your reply. Thank you for your help.
For Webhook responses, they must be sent within 40 seconds. If the OpenAI module takes too long, your Webhook trigger will only send the default “Accepted” text.
This is your prompt:
Generate an investment stratgey for an Indian who’s profession is other, age is 30 and income is 5000. Their monthly savings are 5000 and risk tolerance is high. Keep in mind none. The output should be in similar format : Sensex or nifty ₹1000, any individual high performing stocks ₹200, Gold ₹100, Silver ₹50 and mutual funds smalll cap, medium cap and large cap ₹500 etc. Note that these amounts should add upto the amount of 5000.
Occasionally, this error occurs, leading to the termination of the scenario. The Webhook response module was not executed, so the Trigger responded with the default “Accepted” message.
I can see that you are using the model gpt-3.5-turbo-0613
— You should try try a different OpenAI model that allows more tokens.
Using the model gpt-3.5-turbo-16k-0613
with 1000 max tokens did not encounter this error, and it took about 25 seconds to complete.
Please provide the rewritten markdown content *it should be in the markdown format.
I reviewed the execution history after attempting this a few times. It resolved the timeout issue, but I'm still unable to view the output on the website. The status continues to display "accepted" despite the scenario finishing in less than 30 seconds.
Hello there.
I understand you might be occupied, but it would be greatly appreciated if you could respond.
Thank you.
If you're encountering a timeout issue, you can utilize an HTTP module to manually invoke the API, which effectively bypasses the timeout problem.
Could you please re-upload your latest blueprint export or share screenshots detailing the modifications you've made?
I've adjusted the model to gpt-3.5-turbo-16k-0613
and set the maximum tokens to 1000, as you recommended.
Are there any alternative approaches I could explore to achieve this, or should I focus solely on resolving the current issue?
Wouldn't that expose my API keys in the public code, given I'm developing with Webflow?
No, that should not happen. This is because you are invoking OpenAI via callin.io, not directly from your website, meaning your website code will not contain the OpenAI keys.
Got it.
Will I need to modify anything else in the custom code if I opt for HTTP?
Also, I've reviewed the HTTP tutorial. Could you illustrate how the callin.io scenario would appear?
Thanks for your assistance. I'm eager for your reply.
Hello,
it appears this is not a timeout issue. I am receiving a response within 10-20 seconds, yet it still only displays "accepted".
I would appreciate your assistance.
Awaiting your reply.