How to build a custom webhook field value (or better yet, is there a google chat integration in the works?)
our team uses google chat and I'd love to integrate with our notifications channel, but the webhook fields are limited to dropdown values when I try to build the text json field. I'd love to be able to either:
- use a native google chat integration (heavily preferred) that works just like the Slack one
- build my own field value string using smart tags like this:
New submission | Name: {name_field} | Email: {email_field} | Message: {message_field}
Any thoughts from folks who have done this before?
you could do something like this where you hook into the webhook request data and set your own key with combined information - https://snippets.tdrayson.com/twpo47/
That's a nice approach - might have to include that in my boilerplate install with Bricks. Thanks!
I was able to make this work with a little tweaking with Taylor Drayson's help:
/**
* Webhook payload: add a combined "message" for one Fluent Form only.
*/
function my_ff_webhook_combined_message( $selectedData, $settings, $data, $form, $entry ) {
$target_form_id = 3; // Replace with your Fluent Forms form ID.
if ( (int) $form->id !== $target_form_id ) {
return $selectedData;
}
$first = isset( $data['names']['first_name'] ) ? trim( (string) $data['names']['first_name'] ) : '';
$last = isset( $data['names']['last_name'] ) ? trim( (string) $data['names']['last_name'] ) : '';
$email = isset( $data['email'] ) ? trim( (string) $data['email'] ) : '';
$selectedData['text'] = sprintf(
"Name: %s %s\nEmail: %s",
$first,
$last,
$email
);
return $selectedData;
}
add_filter( 'fluentform/webhook_request_data', 'my_ff_webhook_combined_message', 10, 5 );