Skip to content

Forum in maintenance, we will back soon 🙂

ERROR with Build a ...
 
Notifications
Clear all

ERROR with Build a Backend With No Code Automation Tool “Make”

16 Posts
4 Users
2 Reactions
286 Views
(@paddy)
Posts: 52
Trusted Member
Topic starter
 

hi Hassan i've gotten through to the end of this video but keep getting the below 'oops page cant be found'.

I tested the make.com webhook in url and it works fine.

Ive copied and pasted your code into the wp snippet, and changed the webhook URL to my make.com one.'

I then entered my wordpress custom endpoint address into the url. but get the below. for the URL, I am using:

https://my-wordpress-domain-name/wp-json/custom/v1/make-webhook?topic=happy

image
 
Posted : 08/15/2024 10:18 am
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@paddy what is your "my-wordpress-domain-name" actually. We can review the browser errors from our side.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 08/15/2024 5:03 pm
(@paddy)
Posts: 52
Trusted Member
Topic starter
 

https://aiworkflowpro.io

 
Posted : 08/15/2024 10:25 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@paddy It gives me a login first message. I'm willing to discuss this privately on my Slack channel; see my signature.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 08/16/2024 11:47 am
(@paddy)
Posts: 52
Trusted Member
Topic starter
 
 

@sergiousadvisor Hi Earnie I think you are looking at a different page. Did you try this one? https://aiworkflowpro.io/wp-json/custom/v1/make-webhook?topic=happy

image
 
Posted : 08/16/2024 1:15 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
 

@paddy yes, I get the Oops. The page not being found is due to the fact that your system isn't providing the endpoint for the URL.

image

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 08/16/2024 2:18 pm
Hasan Aboul Hasan
(@admin)
Posts: 1253
Member Admin
 

@paddy can you please share the code snippets

 
Posted : 08/23/2024 7:58 am
(@paddy)
Posts: 52
Trusted Member
Topic starter
 

@admin Hi Hasan please see below

 

// Add a custom endpoint 'make-webhook'
add_action('rest_api_init', function () {
    register_rest_route('custom/v1', '/make-webhook/', array(
        'methods' => 'GET', // Adjust methods as needed (GET, POST, etc.)
        'callback' => 'call_make_webhook', // Callback function to handle the request
        'args' => array(
            'topic' => array(
                'required' => true,
                'validate_callback' => function ($param, $request, $key) {
                    return is_string($param);
                },
            ),
        ),
    ));
});

// Callback function to call the webhook
function call_make_webhook($data) {
    // Retrieve the 'topic' parameter from the request data
    $topic = $data['topic'];

    // Construct the webhook URL with the topic parameter
    $webhook_url = 'https://hook.us1.make.com/mywebhooknormallyhere?topic=' . urlencode($topic);

    // Set the timeout duration in seconds
    $timeout = 30;

    // Prepare arguments for the HTTP GET request
    $args = array(
        'timeout' => $timeout,
    );

    // Perform the HTTP GET request to the webhook URL with timeout
    $response = wp_remote_get($webhook_url, $args);

    // Check if the request was successful
    if (is_wp_error($response)) {
        $error_message = $response->get_error_message();
        error_log('HTTP Error: ' . $error_message);
        return new WP_Error('webhook_error', 'Error connecting to webhook');
    } else {
        // Return the body content of the response
        return wp_remote_retrieve_body($response);
    }
}
 
Posted : 08/23/2024 9:09 am
Hasan Aboul Hasan
(@admin)
Posts: 1253
Member Admin
 

@paddy I will check when you send me the site details

 
Posted : 08/23/2024 9:12 am
Hasan Aboul Hasan
(@admin)
Posts: 1253
Member Admin
 

The problem here is related to caching. When I disabled caching, API endpoints worked. so you may need to exclude the custom API endpoint paths from caching

 

 
Posted : 08/24/2024 12:23 pm
(@paddy)
Posts: 52
Trusted Member
Topic starter
 

thanks for checking on that Hasan. Where can I exclude the custom endpoint paths from caching?

 
Posted : 08/25/2024 10:38 pm
Hasan Aboul Hasan
(@admin)
Posts: 1253
Member Admin
 

@paddy I see you are using litespeed, there must be a place to exclude URLs from cache.

something like:
Litespeed Cache sidebar menu > page optimization > tuning, list your url in “URI Excludes” box.

let me know if you cant find it. I can login to your site again and check.

 

which hosting service you are using?

and did you install litespeed plugin, or you got it with the hosting?

 
Posted : 08/28/2024 2:29 pm
(@paddy)
Posts: 52
Trusted Member
Topic starter
 

@admin Hi Hasan Lightspeed came with the hostinger subscription.

I found the location as you described. So which URL do I need to list in the 'URI Excludes' box? this one?

https://aiworkflowpro.io/wp-json/custom/v1/make-webhook?topic=aiautomation

 
Posted : 08/28/2024 9:40 pm
(@paddy)
Posts: 52
Trusted Member
Topic starter
 

actually it seems to be working now without having to add the URL to the exclude box.

thanks Hasan

 
Posted : 08/28/2024 10:15 pm
SSAdvisor reacted
(@paddy)
Posts: 52
Trusted Member
Topic starter
 

so now that the wordpress php snippet is connecting to make and the webhook works in the browser, how do I connect the snippet to a front end UI?

 
Posted : 08/28/2024 10:18 pm
Page 1 / 2
Share: