configuración de webhock

  • desarrollo_development
    Fecha de consulta 20 de marzo de 2024, 17:39


    Buenas tardes, tengo un problema al configurar un webhook, cuando envío un formulario no llama al webhook configurado, añado el ejemplo del webhock configurado,

    Teóricamente ante cualquier caso debería de guardar el log en el archivo establecido tocayotest.log



    <?php


    // Original Answer


    $method = $_SERVER['REQUEST_METHOD'];
    $data = [
        'cal_method' => $method,
        'called_at' => date('Y/m/d h:i:s')
    ];


    try {


        // $data = $_POST;
        $data['payload'] = json_decode(file_get_contents('php://input'), true);


        $data = json_encode($data);
        //$req_dump = print_r($request, true);


        $fp = file_put_contents('tocayotest.txt', $data, FILE_APPEND); //| LOCK_EX);


        echo $data;
    } catch (Exception $e) {
        http_response_code(500);
        $data["Error"] = $e->getMessage();


        echo json_encode($data);


        $fp = file_put_contents('tocayoteest.log', json_encode($data));
    }
    ?>


    He intentado reemplazar también file_get_contents por $_REQUEST['rawRequest'] sin embargo sigue sin funcionar


  • Ryan Jotform Support
    Fecha de respuesta 20 de marzo de 2024, 20:43

    Hi desarrollo_development,

    Thanks for reaching out to Jotform Support. Unfortunately, our Spanish Support agents are busy helping other Jotform users at the moment. I'll try to help you in English using Google Translate, but you can reply in whichever language you feel comfortable using. Or, if you'd rather have support in Spanish, let us know and we can have them do that. But, keep in mind that you'd have to wait until they're available again.

    Now, let me help you with your question. Can you tell us if you have tried the sample script on our guide here? You can check the script below:

    <?php
    // convert JSON to PHP
    $data = json_decode($_REQUEST['rawRequest'], true);
    // write data to a file
    file_put_contents('webhook_test.txt', print_r($data, true), FILE_APPEND);
    ?>

    Can you test if the form entries will be saved to the text file using this script?

    Give it a try and let us know how it goes.

  • desarrollo_development
    Fecha de respuesta 21 de marzo de 2024, 0:52

    Thank you for your prompt response. I have no issue with continuing our conversation in English; I prefer it, even if it means the support is a bit slower. To answer your question, yes, I have tried using this code. I have been reading through some support inquiries and noticed that other users reported similar issues, specifically the problem of 'the webhook not being fired.' I also followed the instructions provided in this thread, but unfortunately, without success

  • Ravi Jotform Support
    Fecha de respuesta 21 de marzo de 2024, 3:41

    Hi desarrollo_development,

    Thanks for getting back to us. I’m sorry that you're having difficulties with this. I believe you have set up the webhook on Nuevo producto form and having issue in this form only know? You mentioned you followed the steps mentioned here on this thread.

    Just wanted to confirm have tried removing the webhook integration and adding it back or setting it up a new webhook. I have cleared your account cache from the backend, which resolves the cache related issue. Could you try to set up the webhook again and see whether it resolves the issue or not?

    If the issues persist, It would also be great if you could test the webhook on a different form as well to see if the issue is specific to the form.

    Give it a try and let us know how it goes.

  • desarrollo_development
    Fecha de respuesta 22 de marzo de 2024, 16:45

    Greetings, i fix the problem, the problem occurs bys waf configuration on my server, thanks for all.