Using Custom Inputs inside a Custom Webhook Integration #2470
Replies: 2 comments 1 reply
-
|
So you can use shorthand Twig for the Webhook URL if that helps: With the above assuming Otherwise, you're probably going to have better luck using PHP events to modify the payload. use verbb\formie\events\SendIntegrationPayloadEvent;
use verbb\formie\integrations\webhooks\Webhook;
use yii\base\Event;
Event::on(Webhook::class, Webhook::EVENT_BEFORE_SEND_PAYLOAD, function(SendIntegrationPayloadEvent $event) {
$event->endpoint .= '?parent_id=' . $myValue;
}); |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the advice, would this PHP need to go in the I've been using the following Webhook example to build the integration from: https://verbb.io/craft-plugins/formie/docs/developers/custom-integration#example-5 Ideally I'd have access to the parentID and pageID in the sendPayload function, that way I can form the payload object as needed for the CRM API endpoint. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a form which I need to pass some page entry variables to which can then be passed on to the Webhook Endpoint, these are hidden fields that the user doesn't need to see or interact with, they're purely for knowing which subpage the form was submitted from. I'm using customInputs inside the renderForm function, here is an example:
The issue I'm having is accessing this data inside the sendPayload function in my custom Webhook Integration. They're not classed as fields so I can't use the
getFieldValuefunction on the submission object and they're not available by doing$submission['parentID']either.Any advice on getting this data in my payload function would be great.
Beta Was this translation helpful? Give feedback.
All reactions