Forum in maintenance, we will back soon π
@admin where and how do you test it? On heroku my api functions. But for the Saas on WordPress I followed the course and the scripts but when I click on generate Button, nothing happens. Maybe there is something wrong in the js-code?
I tested the backend function, and it is now working. I tested with VS Code.Β
The UI I didn't test it.Β
You need to update the JS code to pass your own function parameters and function name.Β I see you copied my SEO keyword research tool. your tool is different
@admin I am a little bit disappointed. I am trying hard with your template from the saas course "steal my system" but when i use it, my tools dont function.
I created now a simple api that i deployed on render with your fast-api-template and there it functions. i created a php to connect it to wordpress and the ui and it functions. but when i try to put the informations of that tool in your code-snippets with generic-tunnel-function, tool-def-code and common-php, it doesn't funcion.
i try since weeks now to find a solution also with chatgpt and i have no result. can you please review it? here my functioning ui-tool - you have access to my website to see the code:
https://dari-test.um-web.de/ai-tools/health-check-tes
here my functioning php behind it:
function custom_tool_check_health() { // Extract the input value from the POST data $input_value = isset($_POST['input_value']) ? $_POST['input_value'] : ''; // Prepare the API endpoint URL $api_url = 'https://python-fast-api-template.onrender.com/healthcheck?input_value=' . urlencode($input_value); // Prepare headers for the request $headers = [ 'accept' => 'application/json', // Expecting JSON response 'x-api-key' => '123456' // Replace '123456' with your actual API key ]; // Args for the WordPress HTTP API $args = [ 'method' => 'GET', 'headers' => $headers, 'timeout' => 120 ]; // Send the request $response = wp_remote_request($api_url, $args); // Check if there was an error with the request if (is_wp_error($response)) { // Handle WP error $error_message = $response->get_error_message(); wp_send_json_error("Something went wrong: $error_message"); } else { // Extract the response body $body = wp_remote_retrieve_body($response); // Check if the response body is empty if (empty($body)) { wp_send_json_error('Empty response from API'); } else { // Decode the JSON response $data = json_decode($body, true); // Check if JSON decoding was successful if ($data === null && json_last_error() !== JSON_ERROR_NONE) { wp_send_json_error('Invalid JSON in API response'); } else { // Send JSON response wp_send_json($data); } } } } // Register the AJAX action add_action('wp_ajax_custom_tool_check_health', 'custom_tool_check_health'); add_action('wp_ajax_nopriv_custom_tool_check_health', 'custom_tool_check_health');
to make it function, only my snippet is active at moment:
@dari-dar can we assume that the x-api-key value in your code is your actual API key?
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
@dari-dar Hi friend, no worries, it is normal in programming to face some problems and bugs.
Good news: I will record a new lecture and add it to the course on how to do this step by step and the common problems so you can understand exactly what is going on.Β
But for now, let me help you solve the problem, first did you make sure that the WordPress function is working as we discussed earlier?Β
If yes, as I was waiting for this confirmation. Then we can handle the UI.Β
I just want to know if the first problem was solved first.Β
@admin yes. The WordPress function works perfectly. I modified the Ajax-Test-Tool to make sure, that the php connects the ui with my api on Render. Here I created the following UI: https://dari-test.um-web.de/ai-tools/health-check-test
It is connected trough this php:
to my api here - to the healthcheck Endpoint with one input-field:
https://python-fast-api-template.onrender.com/
Β
this my php code and the js code for the ui work perfectly. But when i use the tool-def, the common and the generic-tunnel function, it doesnt function.
Friend, we were working on the SEO API, and it was working perfectly last time, I logged in now to your website, I see the health check endpoint only. And you changed the URL path.Β
And when I test through the API, it returns false:
I am lost now; what happened to the example that we were working on before?Β
Please, friend, let us fix the problem step by step. We were almost done.Β
Just create a simple endpoint that returns success, and let me know so I can fix the full workflow.
@admin I am sorry for the confusion. The point is, that what ever I tried with the SEO API, it didn't function. Thats why I created the Healthcheck Endpoint. A simple Test-App but deployed on render. At the Healthchecker you have one input-field. only if you write "check" in the input-field you have a positive response.
Unfortunately when instead of using my php code snippet ("dr-health-check"), i integrate the informations into the 3 code-snippets from the course, the connection between the api, wordpress and the ui don't function anymore.
the ui is here: https://dari-test.um-web.de/ai-tools/health-check-test
the snippets behind the connection between the api, wordpress and the ui:
when using the codes from the saas course, the tool doesnt function:
@dari-dar you did change the URL(s) in the SaaS code to match yours didn't you? And any API key?
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
The problem is I updated the functions that we are working with, and I added logging and I was able to solve the issue and the function was working perfectly. Now we are back to point zero. I need to start from the beginning to make the function work again.Β
The function is not working, it is not about the UI. I am testing with VS code, and it not working.
Can you get back the last configuration that worked with the SEO tool? there was only the UI problem.Β
@admin I am sorry. I was desperate with the SEO tool. I tought there was something wrong in heroku or else where since the ajax test tool still was saying that the tool was not working.
You said the last time that the seo-tool was working in the backend but I couldn't see it with the ajax-test tool. Thats why I then deleted the seo-tool and created the simple healthchecker and deployed it on render: https://python-fast-api-template.onrender.com/customdocs - when testing on wordpress, you have to go to this link and refresh so that the api starts running, otherwise maybe it seems that it is not working. It is because it is for free and it turns down when not used.
The point is, that this simple "healthchecker" api, runs on render and on wordpress when I use my php code. That was the same with the seo tool. I then copied all the codes from the saas course and only modified for making it run with the api endpoint. but it doesnt work with the codes from the saas course:
I followed the course and in the video of the course you say to use your php codes and just modify it for the tool someone has and it functions. But I am trying since weeks now and whatever I try it doesnt work. My php and my ui work with the tool but I am not able to make it run with your php codes from the course.
I see that you added logging. You mean this right?:
I see the last logging is from the 28.03 from you. When I use the tool, logging is not created. What am I doing wrong?
@ssadvisor yes I did. This is the Link: https://python-fast-api-template.onrender.com/customdocs and the api-key is 123456 - i wrote it in the php code:
function lwh_get_api_key() {
return '123456';
}
function get_custom_tools_api_base_url() {
return "https://python-fast-api-template.onrender.com";
}
So this
https://python-fast-api-template.onrender.com/blog/generate-titles?user_topic=children%27s%20book%20titles
returnsΒ
{
"success": false,
"message": "Failed to generate titles",
"result": null
}
so why are you getting a null result?
The link to your code for /blog/generate-titles again, 5 pages is too lengthy for me to go looking for a previous link.
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack