[SOLVED] Notifications doesn’t work when submitting a form on GravityForm API

By default, notifications only work when submitting through the web interface. If you are submitting forms using the REST API, the notifications will be ignored.

Solution: Add this code to your functions.php (Appearance > Theme Editor > functions.php):


/**
 * Force notifications when submiting a GravityForm via REST API.
 */
add_action( 'gform_post_add_entry', 'add_entry_callback', 10, 2 );
function add_entry_callback( $entry, $form ) {
  if ($form['id'] === 1) {
    GFAPI::send_notifications( $form, $entry );	
  }
}

NOTICE: Change 1 (in yellow) to the form ID you use on the REST API.

Close Menu