Description
The “gform_twilio_message” filter in the Gravity Forms Twilio Add-On is used to modify the SMS message arguments before it is sent.
Usage
The following would apply to all forms:
add_filter( 'gform_twilio_message', 'your_function_name', 10, 4 );
To target a specific form, append the form id to the hook name. (format: gform_twilio_message_FORMID)
add_filter( 'gform_twilio_message_1', 'your_function_name', 10, 4 );
To target a specific form’s feed, append the form id and feed id to the hook name. (format: gform_twilio_message_FORMID_FEEDID)
add_filter( 'gform_twilio_message_1_1', 'your_function_name', 10, 4 );
Parameters
- $args array
The arguments for the SMS message.
$args = { 'to' => '7571234567', 'from' => '7571112222', 'body' => 'This is a test.', 'shorten_url' => '1'};
-
$feed Feed Object
The Feed object.
-
$entry Entry Object
The Entry object.
-
$form Form Object
The Form object.
Examples
add_filter( 'gform_twilio_message', 'change_message', 10, 4 ); function change_message( $args, $feed, $entry, $form ){ $args['body'] = $args['body'] . ' - TEST!'; return $args; }
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Twilio version 2.4.
Source Code
This filter is located in GFTwilio::process_feed() in gravityformstwilio/class-gf-twilio.php.