Send Webhook Trigger from Campain

Your software
My Mautic version is: v4.4.3
My PHP version is: 7.4
My Database type and version is: 10.6.7-MariaDB

My problem is:
Send Webhook Trigger from Campain

These errors are showing in the log:
Último error de ejecución: cURL error 28: Operation timed out after 30001 milliseconds with 0 bytes received (see libcurl - Error Codes) for https://

Steps I have tried to fix the problem:
reproduce PHP code to test cURL is available and diagnostic.

php testing code work fine with :

$payload=array(...)
CURLOPT_POSTFIELDS => http_build_query($payload)

and php testing code fail with :

CURLOPT_POSTFIELDS => array(...)

Some Ideas ?

Can you send through how your web hook looks inside the campaign.

We use web hooks heavily and have not encountered this before. As a test what you can also do is in Settings → Webhooks, go and define a test web hook with your endpoint, set the web hook to fire off for example on a form submission, go and do a form submission and see if you are getting an error on that as well

This is the screen :

I have a partial solution generating a php proxy file, this give me a more details debugging webhook process

Mautic send post body (form … multipart) and you can capture only with php://input

the other application are waiting for a POST array.

my proxy solution :

$values = file_get_contents('php://input');
$post="";
parse_str($values, $post);
$msg = $post["message"];
$id = $post["id"];
$key = $post["key"];
// TODO: add value testing code
$curl = curl_init();
$payload = [
  'id' => $id,
  'message' => $msg
];
curl_setopt_array($curl, array(
  CURLOPT_RETURNTRANSFER => 1,
  CURLOPT_URL => $url . "?key=" . $key,
  CURLOPT_USERAGENT => 'Mautic Connector',
  CURLOPT_POST => 1,
  CURLOPT_POSTFIELDS => http_build_query($payload)
));
$resp = curl_exec($curl);
curl_close($curl);
file_put_contents("../../tmp/webhook.log",($resp.PHP_EOL),FILE_APPEND);

Hi, what is the ‘key’ ?

is a secret

This secret destroys your api call

Sorry, I don’t understand, using my self made PHP proxy the call Works Fine, but debugging Mautic call I get confused about standard call, because Mautic call is mixing POST methods and body construction,
I get from Mautic a body with :
var1=value1&var2=value2&var3=value3
but only can read this body using php://input
My API is waiting for $_POST array and I made this translation on my PHP proxy

With my PHP proxy all work fine, but i think is not the best solution add a patch/fix in the middle of two solutions.

I mess some parameters/configurations on my Mautic deploy ? or we can suggest a eventually Mautic improvement in this calls ?

Hi, sorry I probably misunderstood the purpose of your code.
No, there are no special configs related to webhooks.
I usually just make a webhook.site, see what’s coming and adjust my code.

maybe if you include a header called content-type / value application/x-www-form-urlencoded
it will help the API recognize the post body ;
var1=value1&var2=value2&var3=value3
is the format expected

you can also change the format to json by adding the header “content-type” / value “application/json” that will change the body format from form multipart to json, perhaps this is the format your api expects?