Using a dedicated webhook in our instant trigger in a custom app that triggers when a form is submitted. Trigger works fine, but we need to parse the webhook response before it's returned from the module. The form JSON uses IDs for form fields, and need to write logic to replace the IDs with the human-readable form field titles.
Cannot figure out how to get the webhook response into an IML function to process the body of the webhook response so that the module returns the formatted response.
We have a Zapier trigger that performs the re-mapping like this:
export const transformFormResponses = (formResponses: Array<any>) => {
const transformedResponses = formResponses.map((response) => {
const transformedResponse = { ...response };
// form fields is a map of fieldId to FormResponseField
const formFields: Array<FormResponseField> = Object.values(transformedResponse.fields.formFields || {});
const transformedFormFields = formFields.reduce(
(acc: Record<string, FormResponseField['answer']>, formField: FormResponseField) => {
const { title, answer } = formField;
acc[title] = answer;
return acc;
},
{}
);
transformedResponse.fields.formFields = transformedFormFields;
return transformedResponse;
});
return transformedResponses;
};
This can be written similarly into a custom IML function, but getting webhook response into the function is blocking us.
Have tried:
- RPC called from interface that calls the IML function. The RPC gets called before the webhook even receives the payload, so this will not work
- Calling various Make-specific variables inside the IML function from the instant trigger communication output (webhook, payload, body)
- Calling the IML function directly from webhook communication
Expecting:
- Webhook response logged from debug() call in the IML function