Mautic Community Forums

Mautic campaign Webhooks

Hello,
I see now you can use webhooks in the campaigns. I can see, that you can specify the headers / data for the request FROM mautic, to the webhook endpoint.

I can’t find an option / documentation clarifying whether you can also use the response from the endpoint, further in the campaign.

For example, the campaign triggers a webhook when user submits a form. The campaign webhook calls some external REST API, which will generate a dedicated, time limited gift-code in external application. The API will return JSON with the code and some other data.

Is there any way, to store the response from the API and use it in the campaign (e.g. to send an email / text with the customized gift code?)

The above is just an example, but my question is generally: “Can you send webhook to external api, and store the response data on a lead AND/OR use the response data during campaign execution?”

thanks!

I’m curious about this same exact thing. Would love to know if anyone knows if you can do this!

I also wanted to know if the webhook can take JSON data? Unable to get it to work

We are also interested to see if this issue is resolved! :pray:

You can probably do some processing by subscribing to some of the events that are here:

However I did not try it (yet), but based on how mautic works and how code is structured, this is where I would start.

1 Like

You can’t save the json response data directly in Mautic. However you can call your own script from the webhook, which would call the external api based in the parameters, understand the result and make an api call to Mautic to submit the result.

I have an email cleaning script working like this.
See this blogpost: