Obtaining Your Twilio API Key

Obtaining Your Twilio API Key

Before you may begin using the Twilio Add-On for Gravity Forms, you will first need to obtain your Twilio API keys so that the add-on may communicate with Twilio』s servers. In this article, we will show you how to do exactly that.

Log into your Twilio account.
From the left side menu, click on Settings.
Under API Credentials, you will see both your Live and Test credentials. Note these as they will need to be entered into your Gravity Forms Twilio settings. See Setting Up the Twilio Add-On for more information.

Obtaining Your Mailchimp API Key

Obtaining Your Mailchimp API Key

To use the Mailchimp Add-On for Gravity Forms, you will first need to obtain a Mailchimp API key. In this article, we will show you how to get your Mailchimp API key.

Log into your Mailchimp account.
Click on your name (or profile image) at the bottom left of the screen, then click on Account.
Click on Extras, then API keys.
If you have never used Mailchimp』s API before, you will need to generate an API key. To do so, scroll down the page to the section labeled Your API Keys and click on the Create A Key button.
The page will reload and the Your API keys section will now be populated with your new key.

Obtaining Your Breeze API Key

Obtaining Your Breeze API Key

Before you can use the Gravity Forms Breeze Add-On, you will first need to obtain your API key from Breeze. In this article, we will show you how to do so with just a few steps.

Log into your Breeze account.
Click on your name at the top right corner, then click on Personal settings & password.
Click on the Integrations tab. You will see your API token here. Copy this as you will need it within Gravity Forms.

Number

Number

SummaryCommon SettingsGeneral SettingsNotesMerge TagsUsageModifiers

Summary

The Number field allows a user to enter a number. The field then automatically validates the form data to insure that a number was entered. You can also set a minimum and maximum number and the field will validate that the entered data is within that range. It is available under the Standard Fields section within the form editor.

Number field as displayed in the Field Library

Number field as displayed in the Form Editor.

Common Settings

This field uses only common field settings for the Appearance and Advanced settings. For a description of each of the common field settings, refer to this article. Below you will find description of specialty settings that are particular to this field.

General Settings

SettingDescriptionNumber FormatSelect the format of numbers that are allowed in this field. You have the option to use a comma or a dot as the decimal separator.RangeEnter the minimum and maximum values for this form field. This will require that the value entered by the user must fall within this range.Enable CalculationEnabling calculations will allow the value of this field to be dynamically calculated based on a mathematical formula. See note 1.

Notes

1. See this article for an example and the rules on using numbers in calculations.

Merge Tags

For more information on the use of merge tags, refer to these articles.

Usage

{Field Name:2:modifier}

Modifiers

ModifierDescription:valueTells the merge tag to not use a thousands separator, and instead use the numeric value of the field. Not applicable to currency values.

Number Field CSS Selectors

Number Field CSS Selectors

ContainerInputRange Instructions

Container
example: number field container – applies to all forms (div)
1body .gform_wrapper .gform_body .gform_fields .gfield .ginput_container_number {border: 1px solid red}
example: number field container – applies just to form ID #1 (div)
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .ginput_container_number {border: 1px solid red}
example: number field container – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID) (div)
1body #gform_wrapper_1 .gform_body .gform_fields #field_XX_X.gfield .ginput_container_number {border: 1px solid red}
Input
example: number input – applies to all forms (input)
1body .gform_wrapper .gform_body .gform_fields .gfield .ginput_container_number input {color: red}
example: number field input – applies just to form ID #1 (input)
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .ginput_container_number input {color: red}
example: number field input – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID) (input)
1body #gform_wrapper_1 .gform_body .gform_fields #field_XX_X.gfield .ginput_container_number input {color: red}
Range Instructions
example: Instructions for range allowed – applies to all forms (input)
1body .gform_wrapper .gform_body .gform_fields .gfield .ginput_container_number div.instruction {color: red}
example: Instructions for range allowed – applies just to form ID #1 (input)
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .ginput_container_number div.instruction {color: red}
example: Instructions for range allowed – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID) (input)
1body #gform_wrapper_1 .gform_body .gform_fields #field_XX_X.gfield .ginput_container_number div.instruction {color: red}

Common Questions Regarding Notifications

Common Questions Regarding Notifications

How many notifications can I have?Can I copy a notification to other forms?Can I have one notification for all forms?Why am I not receiving form notification e-mails?

How many notifications can I have?
We don』t have any built-in limitation on the number of notifications you can have. By default, there should be an automatic Admin notification on each form created, and many people will create a User notification to send the data to the people that submit the form as well.
Through the use of conditional logic, you can set-up different notifications to run depending on what a user selects on the form.
Can I copy a notification to other forms?
Not currently, no. You can create the same notification on multiple forms, but you have to do this manually.
Can I have one notification for all forms?
Our notification system works on a per form basis. Currently, you cannot control all of the form notifications from one created notification. You will have to edit the notification on each form.
Why am I not receiving form notification e-mails?
There are many potential reasons you might not receive form notification e-mails. The best way to troubleshoot this issue is to go through the following troubleshooting steps: Troubleshooting Notifications

Notifications Object

Notifications Object

IntroductionUsageNotification PropertiesRouting Rule PropertiesNotification JSON

Introduction

The Notifications object is an associative array containing the properties for all the email notifications which exist for a form. On a default installation when a new form is created a single notification, named Admin Notification, is created for the form. There is no limit to the number of additional notifications you can create.

See the Configuring Notifications In Gravity Forms article for a tutorial showing how you can configure notifications in the admin.

$form['notifications'] = array(
'558a90489ced3' => array(
'isActive' => true,
'id' => '558a90489ced3',
'name' => 'Admin Notification',
'event' => 'form_submission',
'to' => '{admin_email}',
'toType' => 'email',
'subject' => 'New submission from {form_title}',
'message' => '{all_fields}',
'from' => '{admin_email}',
'disableAutoformat' => false,
'enableAttachments' => false
),
'558a905b98b18' => array(
'isActive' => true,
'id' => '558a905b98b18',
'name' => 'User Notification',
'event' => 'form_submission',
'to' => '2',
'toType' => 'field',
'subject' => 'Thanks for your form submission',
'message' => '{all_fields}',
'from' => '{admin_email}',
'conditionalLogic' => array(
'actionType' => 'show',
'logicType' => 'all',
'rules' => array(
array(
'fieldId' => '3',
'operator' => 'is',
'value' => 'Email me a copy',
),
),
),
'disableAutoformat' => false,
'enableAttachments' => false
),
);

Usage

The Notification Object is part of the Form Object and so is most commonly accessed like so:

$notifications = $form['notifications'];

Notification Properties
Each notification is an associative array which can use the following properties.

isActive boolean
Is the notification active or inactive. The default is true (active).

id string
The notification ID. A 13 character unique ID.

name string
The notification name.

service string
The name of the service to be used when sending this notification. Default is wordpress.

event string
The notification event. Default is form_submission.

to string
The ID of an email field, an email address or merge tag to be used as the email to address.

toType string
Identifies what to use for the notification to. Possible values: email, field, routing or hidden

bcc string
The email or merge tags to be used as the email bcc address.

subject string
The email subject line. Merge tags supported.

message string
The email body/content. Merge tags supported.

from string
The email or merge tag to be used as the email from address.

fromName string
The text or merge tag to be used as the email from name.

replyTo string
The email or merge tags to be used as the email reply to address.

routing array
An indexed array containing the routing rules. See Routing Rule Properties properties for each rule.

conditionalLogic array
An associative array containing the conditional logic rules. See the Conditional Logic Object for more details.

disableAutoformat boolean
Determines if the email message should be formatted so that paragraphs are automatically added for new lines. Default is false (auto-formatting enabled).

enableAttachments boolean
Determines if files uploaded on the form should be included when the notification is sent.

Routing Rule Properties
Each routing rule is an associative array containing the following properties.
array(
'fieldId' => '3',
'operator' => 'is',
'value' => 'Email me a copy',
'email' => '{admin_email}',
)

fieldId string
Target field ID. The field that will have it』s value compared with the value property to determine if this rule is a match.

operator string
Operator to be used when evaluating this rule. Possible values: is, isnot, >, <, contains, starts_with, or ends_with. value string The value to compare with the field specified by fieldId. email string The email or merge tag to be used as the email To address if this rule is a match. Notification JSON This example shows how a basic notification array would look when formatted as JSON for use by the Gravity Forms CLI Add-On. { "id": "5acf8e9cf2b40", "to": "{admin_email}", "name": "Admin Notification", "event": "form_submission", "toType": "email", "subject": "New submission from {form_title}", "message": "{all_fields}" }

Sending Notifications on Custom Events when Using the Add-On Framework

Sending Notifications on Custom Events when Using the Add-On Framework

IntroductionRegistering the Add-On EventsTriggering the Sending of the NotificationsGFPaymentAddOnGFFeedAddOnEvents Supported by GFPaymentAddOn

Introduction

Since Gravity Forms 1.9.12, add-ons which extend GFFeedAddOn or GFPaymentAddOn can register custom events for which they will send notifications.
Once the events your add-on supports are registered, the user can then edit their notifications (or create new notifications) and assign them to your new events.
The events drop down only appears on the edit notification page when multiple notification events exist for the form; it will appear between the notification name and send to settings.
Registering the Add-On Events
To register the events for which your add-on will trigger the sending of notifications, override supported_notification_events() with an array containing the event keys and labels.
In this example we are registering a number of events which the Stripe Add-On supports, but only if the form has a Stripe feed.
123456789101112131415public function supported_notification_events( $form ) {    if ( ! $this->has_feed( $form['id'] ) ) {        return false;    }     return array(            'complete_payment'          => esc_html__( 'Payment Completed', 'gravityformsstripe' ),            'refund_payment'            => esc_html__( 'Payment Refunded', 'gravityformsstripe' ),            'fail_payment'              => esc_html__( 'Payment Failed', 'gravityformsstripe' ),            'create_subscription'       => esc_html__( 'Subscription Created', 'gravityformsstripe' ),            'cancel_subscription'       => esc_html__( 'Subscription Canceled', 'gravityformsstripe' ),            'add_subscription_payment'  => esc_html__( 'Subscription Payment Added', 'gravityformsstripe' ),            'fail_subscription_payment' => esc_html__( 'Subscription Payment Failed', 'gravityformsstripe' ),    );}
Triggering the Sending of the Notifications
GFPaymentAddOn
If your add-on extends GFPaymentAddOn and the events are listed under Events supported by GFPaymentAddOn, there』s nothing else to do; the payment framework will handle triggering the notifications when those payment events occur.
If your add-on overrides callback() and specifices a callback parameter in the $action array returned then you would need to trigger the sending of notifications in the function you registered as the callback. You can do that by including the following line in your custom callback:
1$this->post_payment_action( $entry, $action );
GFFeedAddOn
For add-ons which extend GFFeedAddOn you would need to trigger the notifications using the GFAPI::send_notifications method at the appropriate time.
In this example we are triggering notifications for a custom event called feed_processed at the end of the process_feed function.
1234567public function process_feed( $feed, $entry, $form ) {    // feed processing code here     GFAPI::send_notifications( $form, $entry, 'feed_processed' );     return;}
Events Supported by GFPaymentAddOn
GFPaymentAddOn() will automatically trigger the sending of notifications for the following events:

complete_payment
refund_payment
fail_payment
add_pending_payment
void_authorization
create_subscription
cancel_subscription
expire_subscription
add_subscription_payment
fail_subscription_payment

Notification (deprecated)

Notification (deprecated)

IntroductionUsageProperties

Introduction
The Notification object contains the settings for the administrator』s notification, such as destination email address, email subject and body. It is defined as an associative array. For more details on managing your notifications, see the Notifications page.

This article relates to the Notification object used in Gravity Forms 1.6 and earlier. The Notifications Object was introduced in Gravity Forms 1.7.

Usage
$form["notification"]["bcc"]; //returns the BCC email address
$form["notification"]["subject"]; //returns the email subject

Properties

to string
Contains the notification destination email address(es). For multiple emails, separate them with a comma (,) (i.e. [email protected], [email protected]).

from string
If specified, forces the email to be sent from this address. If not specified, the email address configured in WordPress will be used.

fromField string
Id of an email field on the form whose value should be used as the from address.

replyTo string
Contains the email address to be used as the reply to email address.

replyToField string
Id of an email field on the form whose value should be used as the reply to email address.

bcc string
Contains the email address to be used as the bcc email address.

subject string
Contains the subject of the email.

message string
Contains the body/content of the email.

disableAutoformat boolean
Determines if the email message should be formatted so that paragraphs are automatically added for new lines. 1 disables auto-formatting, 0 enables auto-formatting.

routing array
Allows notifications to be routed to different email addresses based on field values entered on the form. This array contains multiple routing rules. Each rule is evaluated separately and the notification will be sent to all rules that match.
$form["notification"]["routing"][0]["email"]; //returns the email of the first routing rule

Following are the properties or each routing rule

fieldId integer
Target field Id. Field that will have it』s value compared with the value property to determine if this rule is a match

operator string
Operator to be used when evaluating this rule.
Possible values: is, isnot

is: Evaluates this rule to true when the value property is equal to the value of field specified by fieldId.
isnot: Evaluates this rule to true when the value property is not equal to the value of field specified by fieldId.

value string
The value to compare with the field specified by fieldId

Adding a New Notification Service Using the Add-On Framework

Adding a New Notification Service Using the Add-On Framework

IntroductionThe HooksAdd the ServiceIntercept the NotificationSend the EmailFurther Reading

Introduction
Gravity Forms 1.9.16 added the ability for the user to select which service is used to send the notification; on a default install only WordPress (wp_mail()) will be available.
The Hooks
Adding a new service can be accomplished using a minimum of two hooks in the init function of your add-on.
1234567891011/** * Plugin starting point. Handles hooks, loading of language files, and PayPal delayed payment support. */public function init() {     parent::init();     add_filter( 'gform_notification_services', array( $this, 'add_notification_service' ) );    add_filter( 'gform_pre_send_email', array( $this, 'maybe_send_email' ), 19, 3 ); }
Add the Service
The gform_notification_services filter is used to add the new choice to the 「Email Service」 setting on the edit notification page.
This example assumes that your add-on has an initialize_api() function used to include the API files and connect to the service to validate any API credentials. If the credentials are valid, the choice for the new service will be added.
12345678910111213141516171819/** * Add the new notification service. * * @param array $services The notification services. * * @return array */public function add_notification_service( $services ) {     // If the API can be initialized, add the service.    if ( $this->initialize_api() ) {        $services['the_service_name'] = array(            'label' => esc_html__( 'The Service Name', 'sometextdomain' ),            'image' => $this->get_base_url() . '/images/icon.png',        );    }     return $services;}
Intercept the Notification
The gform_pre_send_email filter is used to intercept the notification email, pass the email to the new service, and then prevent WordPress and other add-ons from also sending the email.
1234567891011121314151617181920212223242526272829303132/** * If the notification "Email Service" setting is a match prepare to send the email. * * @param array $email The email properties. * @param string $message_format The message format, html, or text. * @param array $notification The Notification object which produced the current email. * * @return array */public function maybe_send_email( $email, $message_format, $notification ) {     // If the notification is not assigned to this service or the service API is not initialized, return the email.    if ( rgar( $notification, 'service' ) !== 'the_service_name' || ! $this->initialize_api() ) {        return $email;    }     // If the email has already been aborted, return the email.    if ( $email['abort_email'] ) {        $this->log_debug( __METHOD__ . '(): Not sending email because the notification has already been aborted by another Add-On.' );         return $email;    }     $result = $this->send_email( $email, $message_format, $notification );     if ( $result ) {        // The service successfully sent the email; prevent WordPress and other add-ons from also sending the email.        $email['abort_email'] = true;    }     return $email;}
Send the Email
Now we know that no other add-ons have already aborted the email and that this service was selected for the notification the email can be processed and passed to the service for delivery.
123456789101112131415/** * Send the email via the new service. * * @param array $email The email properties. * @param string $message_format The message format, html, or text. * @param array $notification The Notification object which produced the current email. * * @return bool */public function send_email( $email, $message_format, $notification ) {     // pass the email to the service     return $result;}
Further Reading
Depending on the service you may also want to add custom settings to the notification configuration page. You can do that using the following hooks:

gform_notification_ui_settings
gform_pre_notification_save
gform_notification_validation

Any settings added by these hooks would be available in the $notification passed to maybe_send_email() and send_email().