diff --git a/README.md b/README.md
index a081016..d098948 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# Gragrid: Gravity Forms + SendGrid
[![GitHub Workflows](https://github.com/vlasscontreras/gragrid/workflows/Build/badge.svg)](https://github.com/vlasscontreras/gragrid)
-[![Version](https://img.shields.io/badge/version-2.0.0-brightgreen.svg)](https://github.com/vlasscontreras/gragrid)
+[![Version](https://img.shields.io/badge/version-2.1.0-brightgreen.svg)](https://github.com/vlasscontreras/gragrid)
[![Plugin Version](https://img.shields.io/wordpress/plugin/v/gragrid)](https://wordpress.org/plugins/gragrid/)
[![PHP Version](https://img.shields.io/wordpress/plugin/required-php/gragrid)](https://github.com/vlasscontreras/gragrid)
[![WordPress Plugin: Required WP Version](https://img.shields.io/wordpress/plugin/wp-version/gragrid)](https://github.com/vlasscontreras/gragrid)
@@ -27,4 +27,13 @@ Filters the remote request arguments used when communicating with the SendGrid A
- `$args` (array): Request arguments, includes headers, method, body, etc.
- `$path` (string): The specific API endpoint being called.
+
+```php
+apply_filters( 'gragrid_contact_params', array $contact_params, array $entry, array $form )
+```
+
+- `$contact_params` (array): Contact parameters, includes first name, email, custom fields, etc.
+- `$entry` (array): The form entry that was just created.
+- `$form` (array): The current form, the origin of the submission.
+
_Inspired by [Gravity Form Mailchimp Add-On](https://www.gravityforms.com/add-ons/mailchimp/)._
diff --git a/assets/screenshot-1.png b/assets/screenshot-1.png
index 8ac13e0..f60493f 100644
Binary files a/assets/screenshot-1.png and b/assets/screenshot-1.png differ
diff --git a/assets/screenshot-2.png b/assets/screenshot-2.png
index 01be8e7..b09d529 100644
Binary files a/assets/screenshot-2.png and b/assets/screenshot-2.png differ
diff --git a/assets/screenshot-3.png b/assets/screenshot-3.png
index 4e1859b..361c4a5 100644
Binary files a/assets/screenshot-3.png and b/assets/screenshot-3.png differ
diff --git a/class-gragrid.php b/class-gragrid.php
index 43eaf84..1a211c6 100644
--- a/class-gragrid.php
+++ b/class-gragrid.php
@@ -12,6 +12,8 @@
GFForms::include_feed_addon_framework();
+require_once 'includes/concerns/class-gragrid-converts-case.php';
+
/**
* The SendGrid Add-on Class
*
@@ -19,6 +21,8 @@
* @author Vladimir Contreras
*/
class Gragrid extends GFFeedAddOn {
+ use Gragrid_Converts_Case;
+
/**
* Contains an instance of this class, if available.
*
@@ -206,59 +210,82 @@ public function plugin_settings_fields() {
* Configures the settings which should be rendered on the feed edit page.
*
* @since 1.0.0
- * @since 1.1.0 Adds conditional feed setting.
+ * @since 1.1.0 Added conditional feed setting.
+ * @since 2.1.0 Added custom field mapping.
*
* @access public
* @return array
*/
public function feed_settings_fields() {
+ $custom_fields = $this->sengrid_custom_fields_map();
+ $custom_field_map = null;
+
+ if ( ! count( $custom_fields ) > 0 ) {
+ $this->log_error( __METHOD__ . ': API retured empty set of custom fields.' );
+ } else {
+ $custom_field_map = array(
+ 'name' => 'mappedCustomFields',
+ 'label' => esc_html__( 'Custom Fields', 'gragrid' ),
+ 'type' => 'field_map',
+ 'field_map' => $custom_fields,
+ 'tooltip' => sprintf(
+ '
%s
%s',
+ esc_html__( 'Custom Fields', 'gragrid' ),
+ esc_html__( 'Associate your custom SendGrid fields to the appropriate Gravity Form fields by selecting the appropriate form field from the list.', 'gragrid' )
+ ),
+ );
+ }
+
+ $fields = array(
+ array(
+ 'name' => 'feedName',
+ 'label' => esc_html__( 'Name', 'gragrid' ),
+ 'type' => 'text',
+ 'required' => true,
+ 'class' => 'medium',
+ 'tooltip' => sprintf(
+ '%s
%s',
+ esc_html__( 'Name', 'gragrid' ),
+ esc_html__( 'Enter a feed name to uniquely identify this setup.', 'gragrid' )
+ ),
+ ),
+ array(
+ 'name' => 'sendgrid_list',
+ 'label' => esc_html__( 'SendGrid Contact List', 'gragrid' ),
+ 'type' => 'sendgrid_list',
+ 'required' => true,
+ 'tooltip' => sprintf(
+ '%s
%s',
+ esc_html__( 'SendGrid Contact List', 'gragrid' ),
+ esc_html__( 'Select the contact list you would like to add emails s to.', 'gragrid' )
+ ),
+ ),
+ array(
+ 'name' => 'mappedFields',
+ 'label' => esc_html__( 'Map Fields', 'gragrid' ),
+ 'type' => 'field_map',
+ 'field_map' => $this->sengrid_field_map(),
+ 'tooltip' => sprintf(
+ '%s
%s',
+ esc_html__( 'Map Fields', 'gragrid' ),
+ esc_html__( 'Associate the SendGrid fields to the appropriate Gravity Form fields by selecting the appropriate form field from the list.', 'gragrid' )
+ ),
+ ),
+ $custom_field_map,
+ array(
+ 'type' => 'feed_condition',
+ 'name' => 'enabled',
+ 'label' => __( 'Conditional logic', 'gragrid' ),
+ 'checkbox_label' => __( 'Enable', 'gragrid' ),
+ 'instructions' => __( 'Send this lead to SendGrid if', 'gragrid' ),
+ ),
+ array( 'type' => 'save' ),
+ );
+
$settings = array(
array(
'title' => esc_html__( 'SendGrid Feed Settings', 'gragrid' ),
- 'fields' => array(
- array(
- 'name' => 'feedName',
- 'label' => esc_html__( 'Name', 'gragrid' ),
- 'type' => 'text',
- 'required' => true,
- 'class' => 'medium',
- 'tooltip' => sprintf(
- '%s
%s',
- esc_html__( 'Name', 'gragrid' ),
- esc_html__( 'Enter a feed name to uniquely identify this setup.', 'gragrid' )
- ),
- ),
- array(
- 'name' => 'sendgrid_list',
- 'label' => esc_html__( 'SendGrid Contact List', 'gragrid' ),
- 'type' => 'sendgrid_list',
- 'required' => true,
- 'tooltip' => sprintf(
- '%s
%s',
- esc_html__( 'SendGrid Contact List', 'gragrid' ),
- esc_html__( 'Select the contact list you would like to add emails s to.', 'gragrid' )
- ),
- ),
- array(
- 'name' => 'mappedFields',
- 'label' => esc_html__( 'Map Fields', 'gragrid' ),
- 'type' => 'field_map',
- 'field_map' => $this->sengrid_field_map(),
- 'tooltip' => sprintf(
- '%s
%s',
- esc_html__( 'Map Fields', 'gragrid' ),
- esc_html__( 'Associate the SendGrid fields to the appropriate Gravity Form fields by selecting the appropriate form field from the list.', 'gragrid' )
- ),
- ),
- array(
- 'type' => 'feed_condition',
- 'name' => 'enabled',
- 'label' => __( 'Conditional logic', 'gragrid' ),
- 'checkbox_label' => __( 'Enable', 'gragrid' ),
- 'instructions' => __( 'Send this lead to SendGrid if', 'gragrid' ),
- ),
- array( 'type' => 'save' ),
- ),
+ 'fields' => array_filter( $fields ),
),
);
@@ -339,6 +366,8 @@ public function settings_sendgrid_list( $field, $echo = true ) {
* Return an array of SendGrid list/audience fields which can be mapped to the Form fields/entry meta.
*
* @since 1.0.0
+ * @since 2.0.0 Added address fields.
+ * @since 2.1.0 Added more default SendGrid fields.
*
* @access public
* @return array
@@ -363,6 +392,12 @@ public function sengrid_field_map() {
'required' => false,
'field_type' => array( 'name', 'text', 'hidden' ),
),
+ 'phone_number' => array(
+ 'name' => 'phone_number',
+ 'label' => esc_html__( 'Phone Number', 'gragrid' ),
+ 'required' => false,
+ 'field_type' => array( 'phone', 'text', 'hidden' ),
+ ),
'address_line_1' => array(
'name' => 'address_line_1',
'label' => esc_html__( 'Address Line 1', 'gragrid' ),
@@ -399,9 +434,56 @@ public function sengrid_field_map() {
'required' => false,
'field_type' => array( 'address', 'text', 'hidden' ),
),
+ 'whatsapp' => array(
+ 'name' => 'whatsapp',
+ 'label' => esc_html__( 'WhatsApp', 'gragrid' ),
+ 'required' => false,
+ 'field_type' => array( 'phone', 'text', 'hidden' ),
+ ),
+ 'line' => array(
+ 'name' => 'line',
+ 'label' => esc_html__( 'Line', 'gragrid' ),
+ 'required' => false,
+ 'field_type' => array( 'phone', 'text', 'hidden' ),
+ ),
+ 'facebook' => array(
+ 'name' => 'facebook',
+ 'label' => esc_html__( 'Facebook', 'gragrid' ),
+ 'required' => false,
+ 'field_type' => array( 'website', 'text', 'hidden' ),
+ ),
+ 'unique_name' => array(
+ 'name' => 'unique_name',
+ 'label' => esc_html__( 'Unique Name', 'gragrid' ),
+ 'required' => false,
+ 'field_type' => array( 'name', 'text', 'hidden' ),
+ ),
);
}
+ /**
+ * Map custom SendGrid fields
+ *
+ * @since 2.1.0
+ *
+ * @return array
+ */
+ public function sengrid_custom_fields_map() {
+ $fields = array();
+ $custom_fields = (array) rgar( $this->api->get_custom_fields(), 'custom_fields' );
+ $custom_fields = array_filter( $custom_fields );
+
+ foreach ( $custom_fields as $custom_field ) {
+ $fields[ $custom_field['id'] ] = array(
+ 'name' => $custom_field['id'],
+ 'label' => $this->snake_to_title( $custom_field['name'] ),
+ 'required' => false,
+ );
+ }
+
+ return $fields;
+ }
+
/**
* Prevent feeds being listed or created if the API key isn't valid.
*
@@ -470,10 +552,12 @@ public function get_column_value_sendgrid_list( $feed ) {
/**
* Process the feed e.g. subscribe the user to a list.
*
+ * @since 1.0.0
+ * @since 2.1.0 Added custom fields to the request data.
+ *
* @param array $feed The feed object to be processed.
* @param array $entry The entry object currently being processed.
* @param array $form The form object currently being processed.
- *
* @return bool|void
*/
public function process_feed( $feed, $entry, $form ) {
@@ -483,18 +567,38 @@ public function process_feed( $feed, $entry, $form ) {
return $entry;
}
- $fields = $this->get_field_map_fields( $feed, 'mappedFields' );
$contact = array();
+ // Map reserved/standard/default fields.
+ $fields = $this->get_field_map_fields( $feed, 'mappedFields' );
+
foreach ( $fields as $name => $field_id ) {
$contact[ $name ] = $this->get_field_value( $form, $entry, $field_id );
}
+ // Map custom fields.
+ $custom_fields = $this->get_field_map_fields( $feed, 'mappedCustomFields' );
+
+ foreach ( $custom_fields as $name => $field_id ) {
+ $contact['custom_fields'][ $name ] = $this->get_field_value( $form, $entry, $field_id );
+ }
+
$contact_params = array(
'list_ids' => array( rgars( $feed, 'meta/sendgrid_list' ) ),
'contacts' => array( $contact ),
);
+ /**
+ * Contact parameters
+ *
+ * @since 2.1.0
+ *
+ * @param array $contact_params Contact parameters.
+ * @param array $entry The entry object currently being processed.
+ * @param array $form The form object currently being processed.
+ */
+ $contact_params = apply_filters( 'gragrid_contact_params', $contact_params, $entry, $form );
+
try {
// Save the contacts.
$response = $this->api->add_contacts( $contact_params );
diff --git a/composer.json b/composer.json
index 2a71b02..465a8a1 100644
--- a/composer.json
+++ b/composer.json
@@ -16,7 +16,7 @@
}
],
"require": {
- "php": ">=7.2"
+ "php": ">=7.3"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
diff --git a/composer.lock b/composer.lock
index c7926da..7346975 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "b9ac18c21eccfd65146d8ea3a0ed8964",
+ "content-hash": "b8ea752c31019014be2d46378b6f949c",
"packages": [],
"packages-dev": [
{
@@ -79,16 +79,16 @@
},
{
"name": "gettext/gettext",
- "version": "v4.8.3",
+ "version": "v4.8.4",
"source": {
"type": "git",
"url": "https://github.com/php-gettext/Gettext.git",
- "reference": "57ff4fb16647e78e80a5909fe3c190f1c3110321"
+ "reference": "58bc0f7f37e78efb0f9758f93d4a0f669f0f84a1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-gettext/Gettext/zipball/57ff4fb16647e78e80a5909fe3c190f1c3110321",
- "reference": "57ff4fb16647e78e80a5909fe3c190f1c3110321",
+ "url": "https://api.github.com/repos/php-gettext/Gettext/zipball/58bc0f7f37e78efb0f9758f93d4a0f669f0f84a1",
+ "reference": "58bc0f7f37e78efb0f9758f93d4a0f669f0f84a1",
"shasum": ""
},
"require": {
@@ -140,9 +140,23 @@
"support": {
"email": "oom@oscarotero.com",
"issues": "https://github.com/oscarotero/Gettext/issues",
- "source": "https://github.com/php-gettext/Gettext/tree/v4.8.3"
+ "source": "https://github.com/php-gettext/Gettext/tree/v4.8.4"
},
- "time": "2020-11-18T22:35:49+00:00"
+ "funding": [
+ {
+ "url": "https://paypal.me/oscarotero",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/oscarotero",
+ "type": "github"
+ },
+ {
+ "url": "https://www.patreon.com/misteroom",
+ "type": "patreon"
+ }
+ ],
+ "time": "2021-03-10T19:35:49+00:00"
},
{
"name": "gettext/languages",
@@ -698,16 +712,16 @@
},
{
"name": "symfony/finder",
- "version": "v5.2.3",
+ "version": "v5.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "4adc8d172d602008c204c2e16956f99257248e03"
+ "reference": "0d639a0943822626290d169965804f79400e6a04"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/4adc8d172d602008c204c2e16956f99257248e03",
- "reference": "4adc8d172d602008c204c2e16956f99257248e03",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/0d639a0943822626290d169965804f79400e6a04",
+ "reference": "0d639a0943822626290d169965804f79400e6a04",
"shasum": ""
},
"require": {
@@ -739,7 +753,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/finder/tree/v5.2.3"
+ "source": "https://github.com/symfony/finder/tree/v5.2.4"
},
"funding": [
{
@@ -755,7 +769,7 @@
"type": "tidelift"
}
],
- "time": "2021-01-28T22:06:19+00:00"
+ "time": "2021-02-15T18:55:04+00:00"
},
{
"name": "wp-cli/i18n-command",
@@ -871,16 +885,16 @@
},
{
"name": "wp-cli/php-cli-tools",
- "version": "v0.11.11",
+ "version": "v0.11.12",
"source": {
"type": "git",
"url": "https://github.com/wp-cli/php-cli-tools.git",
- "reference": "fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f"
+ "reference": "e472e08489f7504d9e8c5c5a057e1419cd1b2b3e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f",
- "reference": "fe9c7c44a9e1bf2196ec51dc38da0593dbf2993f",
+ "url": "https://api.github.com/repos/wp-cli/php-cli-tools/zipball/e472e08489f7504d9e8c5c5a057e1419cd1b2b3e",
+ "reference": "e472e08489f7504d9e8c5c5a057e1419cd1b2b3e",
"shasum": ""
},
"require": {
@@ -900,15 +914,15 @@
"MIT"
],
"authors": [
- {
- "name": "James Logsdon",
- "email": "jlogsdon@php.net",
- "role": "Developer"
- },
{
"name": "Daniel Bachhuber",
"email": "daniel@handbuilt.co",
"role": "Maintainer"
+ },
+ {
+ "name": "James Logsdon",
+ "email": "jlogsdon@php.net",
+ "role": "Developer"
}
],
"description": "Console utilities for PHP",
@@ -919,9 +933,9 @@
],
"support": {
"issues": "https://github.com/wp-cli/php-cli-tools/issues",
- "source": "https://github.com/wp-cli/php-cli-tools/tree/master"
+ "source": "https://github.com/wp-cli/php-cli-tools/tree/v0.11.12"
},
- "time": "2018-09-04T13:28:00+00:00"
+ "time": "2021-03-03T12:43:49+00:00"
},
{
"name": "wp-cli/wp-cli",
@@ -1049,7 +1063,7 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
- "php": ">=7.2"
+ "php": ">=7.3"
},
"platform-dev": [],
"plugin-api-version": "2.0.0"
diff --git a/gragrid.php b/gragrid.php
index 595c6fc..1b08c75 100644
--- a/gragrid.php
+++ b/gragrid.php
@@ -10,7 +10,7 @@
* Plugin Name: Gragrid: Gravity Forms + SendGrid
* Plugin URI: https://github.com/vlasscontreras/gragrid
* Description: Integrates Gravity Forms with SendGrid, allowing form submissions to be automatically sent to your SendGrid contact lists.
- * Version: 2.0.0
+ * Version: 2.1.0
* Requires at least: 5.2
* Requires PHP: 7.3
* Author: Vladimir Contreras
@@ -28,7 +28,7 @@
/**
* Current add-on version
*/
-define( 'GRAGRID_VERSION', '2.0.0' );
+define( 'GRAGRID_VERSION', '2.1.0' );
/**
* If the Feed Add-On Framework exists, SendGrid Add-On is loaded.
diff --git a/includes/class-gragrid-api.php b/includes/class-gragrid-api.php
index 49d28c2..6fe4c6e 100644
--- a/includes/class-gragrid-api.php
+++ b/includes/class-gragrid-api.php
@@ -76,6 +76,24 @@ public function get_list( $list_id ) {
return $response['body'];
}
+ /**
+ * Get SendGrid custom fields.
+ *
+ * @since 2.1.0
+ *
+ * @access public
+ * @return array|WP_Error
+ */
+ public function get_custom_fields() {
+ $response = $this->request( '/marketing/field_definitions' );
+
+ if ( ! $this->is_valid_response( $response, 200 ) ) {
+ return $this->set_error( $response );
+ }
+
+ return $response['body'];
+ }
+
/**
* Add new contacts.
*
diff --git a/includes/concerns/class-gragrid-converts-case.php b/includes/concerns/class-gragrid-converts-case.php
new file mode 100644
index 0000000..d9a9790
--- /dev/null
+++ b/includes/concerns/class-gragrid-converts-case.php
@@ -0,0 +1,33 @@
+\n"
"Language-Team: LANGUAGE \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"POT-Creation-Date: 2021-02-28T18:42:17+00:00\n"
+"POT-Creation-Date: 2021-03-13T22:16:18+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.1.0\n"
"X-Domain: gragrid\n"
@@ -34,135 +34,164 @@ msgstr ""
msgid "https://github.com/vlasscontreras"
msgstr ""
-#: class-gragrid.php:130
+#: class-gragrid.php:134
msgid "Gravity Forms: SendGrid Add-on"
msgstr ""
#. Translators: 1 open anchor tag, 2 close anchor tag, 3 open anchor tag, 4 close anchor tag.
-#: class-gragrid.php:183
+#: class-gragrid.php:187
msgid "SendGrid makes it easy to reliably send email notifications. If you don't have a SendGrid account, you can %1$ssign up for one here%2$s. Once you have signed up, you can %3$sfind your API keys here%4$s."
msgstr ""
-#: class-gragrid.php:193
+#: class-gragrid.php:197
msgid "SendGrid API Key"
msgstr ""
-#: class-gragrid.php:217
-msgid "SendGrid Feed Settings"
+#: class-gragrid.php:228
+#: class-gragrid.php:233
+msgid "Custom Fields"
msgstr ""
-#: class-gragrid.php:221
-#: class-gragrid.php:227
-#: class-gragrid.php:439
+#: class-gragrid.php:234
+msgid "Associate your custom SendGrid fields to the appropriate Gravity Form fields by selecting the appropriate form field from the list."
+msgstr ""
+
+#: class-gragrid.php:242
+#: class-gragrid.php:248
+#: class-gragrid.php:521
msgid "Name"
msgstr ""
-#: class-gragrid.php:228
+#: class-gragrid.php:249
msgid "Enter a feed name to uniquely identify this setup."
msgstr ""
-#: class-gragrid.php:233
-#: class-gragrid.php:238
+#: class-gragrid.php:254
+#: class-gragrid.php:259
msgid "SendGrid Contact List"
msgstr ""
-#: class-gragrid.php:239
+#: class-gragrid.php:260
msgid "Select the contact list you would like to add emails s to."
msgstr ""
-#: class-gragrid.php:244
-#: class-gragrid.php:249
+#: class-gragrid.php:265
+#: class-gragrid.php:270
msgid "Map Fields"
msgstr ""
-#: class-gragrid.php:250
+#: class-gragrid.php:271
msgid "Associate the SendGrid fields to the appropriate Gravity Form fields by selecting the appropriate form field from the list."
msgstr ""
-#: class-gragrid.php:256
+#: class-gragrid.php:278
msgid "Conditional logic"
msgstr ""
-#: class-gragrid.php:257
+#: class-gragrid.php:279
msgid "Enable"
msgstr ""
-#: class-gragrid.php:258
+#: class-gragrid.php:280
msgid "Send this lead to SendGrid if"
msgstr ""
+#: class-gragrid.php:287
+msgid "SendGrid Feed Settings"
+msgstr ""
+
#. Translators: 1 line break, 2 error message.
-#: class-gragrid.php:292
+#: class-gragrid.php:319
msgid "Could not load the contact lists. %1$sError: %2$s"
msgstr ""
-#: class-gragrid.php:303
+#: class-gragrid.php:330
msgid "You don't have contact lists in your account. Please create one first and try again."
msgstr ""
-#: class-gragrid.php:311
+#: class-gragrid.php:338
msgid "Select a SendGrid list"
msgstr ""
-#: class-gragrid.php:350
+#: class-gragrid.php:379
msgid "Email Address"
msgstr ""
-#: class-gragrid.php:356
+#: class-gragrid.php:385
msgid "First Name"
msgstr ""
-#: class-gragrid.php:362
+#: class-gragrid.php:391
msgid "Last Name"
msgstr ""
-#: class-gragrid.php:368
+#: class-gragrid.php:397
+msgid "Phone Number"
+msgstr ""
+
+#: class-gragrid.php:403
msgid "Address Line 1"
msgstr ""
-#: class-gragrid.php:374
+#: class-gragrid.php:409
msgid "Address Line 2"
msgstr ""
-#: class-gragrid.php:380
+#: class-gragrid.php:415
msgid "City"
msgstr ""
-#: class-gragrid.php:386
+#: class-gragrid.php:421
msgid "State/Province/Region"
msgstr ""
-#: class-gragrid.php:392
+#: class-gragrid.php:427
msgid "Postal Code"
msgstr ""
-#: class-gragrid.php:398
+#: class-gragrid.php:433
msgid "Country"
msgstr ""
-#: class-gragrid.php:440
+#: class-gragrid.php:439
+msgid "WhatsApp"
+msgstr ""
+
+#: class-gragrid.php:445
+msgid "Line"
+msgstr ""
+
+#: class-gragrid.php:451
+msgid "Facebook"
+msgstr ""
+
+#: class-gragrid.php:457
+msgid "Unique Name"
+msgstr ""
+
+#: class-gragrid.php:522
msgid "SendGrid List"
msgstr ""
-#: class-gragrid.php:481
+#: class-gragrid.php:565
msgid "Unable to process feed because API could not be initialized."
msgstr ""
#. Translators: %s error message.
-#: class-gragrid.php:504
+#: class-gragrid.php:608
msgid "Unable to add the contact: %s"
msgstr ""
#. Translators: %s SendGrid list ID.
-#: class-gragrid.php:513
+#: class-gragrid.php:617
msgid "Gragrid successfully passed the lead details to the SendGrid list #%s."
msgstr ""
#. Translators: %s error message.
-#: class-gragrid.php:522
+#: class-gragrid.php:626
msgid "Unable to add recipient to list: %s"
msgstr ""
-#: includes/class-gragrid-api.php:122
+#: includes/class-gragrid-api.php:140
msgid "API key must be defined to process an API request."
msgstr ""
diff --git a/readme.txt b/readme.txt
index c5cccb9..55cea35 100644
--- a/readme.txt
+++ b/readme.txt
@@ -5,7 +5,7 @@ Tags: forms, emails, subscribers, sendgrid, gravity forms
Requires at least: 5.2
Tested up to: 5.7
Requires PHP: 7.3
-Stable tag: 2.0.0
+Stable tag: 2.1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -35,6 +35,10 @@ To map:
The field dropdowns show the [Field Label](https://docs.gravityforms.com/common-field-settings/#field-label) or [Admin Field Label](https://docs.gravityforms.com/common-field-settings/#admin-field-label), so make sure you have either of those set up in your fields. Or both, it's also a good practice for accessibility!
+= Why I don't see any custom fields in the form settings? =
+
+The custom field mapping won't appear unless you have at least 1 custom field in your SendGrid account, so make sure you have at least one.
+
= Can this plugin be installed at the same time as the official SendGrid Gravity Forms add-on? =
Yes. The official add-on and this plugin have different purposes and do not have conflicts in between.
@@ -45,7 +49,15 @@ Yes. Just like Gravity Forms' SendGrid add-on, this plugin serves a different pu
== Advanced ==
-You can customize the SendGrid API requests using the following hook:
+You can customize the contact data sent to SendGrid in the entry submission context with this hook:
+
+`apply_filters( 'gragrid_contact_params', array $contact_params, array $entry, array $form )`
+
+- `$contact_params` (array): Contact parameters, includes first name, email, custom fields, etc.
+- `$entry` (array): The form entry that was just created.
+- `$form` (array): The current form, the origin of the submission.
+
+You can also customize the SendGrid API requests using the following hook:
`apply_filters( 'gragrid_request_args', array $args, string $path )`
@@ -60,10 +72,15 @@ You can customize the SendGrid API requests using the following hook:
== Changelog ==
+= 2.1.0 =
+* Adds support to map more reserved/default SendGrid fields
+* Adds support to map custom fields 🥳
+* Introduces a new filter hook `gragrid_contact_params` to filter contact data at entry context
+
= 2.0.0 =
* Uses Twilio SendGrid's new Marketing Campaigns API (see [#9](https://github.com/vlasscontreras/gragrid/issues/9))
* Adds address fields to map them to SendGrid Contacts
-* New logo 🎨
+* New logo 💅🏻
= 1.1.0 =
* Adds support for conditional feeds