kennym / cf7-to-api Goto Github PK
View Code? Open in Web Editor NEWLOOKING FOR MAINTAINER. Wordpress plugin to transmit contact form 7 entries to remote API using POST or GET
Home Page: https://wordpress.org/plugins/cf7-to-api-basic-auth/
LOOKING FOR MAINTAINER. Wordpress plugin to transmit contact form 7 entries to remote API using POST or GET
Home Page: https://wordpress.org/plugins/cf7-to-api-basic-auth/
Contact form 7 TO API + Basic Auth ================================== MAINTAINER NEEDED. Please email me if you're interested. - Tags: contact form 7 to api,contact form 7,cf7 api,cf7 get,contact form 7 post,contact form7 get,contact form 7 remote, Contact form 7 crm, contact form 7 integration,contact form 7 integrations, contact form 7 rest api, - Requires at least: 4.7.0 - Tested up to: 5.2.2 - Stable tag: 1.4.5 - License: GPLv3 or later - License URI: <http://www.gnu.org/licenses/gpl-3.0.html> An addon to transmit contact form 7 entries to remote API using POST or GET. Description ----------- Adds an option to send leads to remote API's such as CRM's ERP's and other remote systems using POST/GET. NOTE: This plugin requires Contact Form 7 version 4.2 or later. - Supports XML and JSON\ - Supports Basic Auth\ - Supports Bearer Auth Usage ----- Simply go to your form settings, choose the "Redirect Settings" tab and set your required parameters, 1. Chose wether the specific form will use the API integrations 2. Type the API url 3. Select the method (POST/GET) 4. map the form fields (Each field that you use on the form will be availble on this tab after saving the form) 5. choose wether you wish to debug and save the last transmited value. Installation ------------ Installing Contact form 7 TO API can be done either by searching for "Contact form 7 TO API" via the "Plugins \> Add New" screen in your WordPress dashboard, or by using the following steps: 1. Download the plugin via WordPress.org. 2. Upload the ZIP file through the "Plugins" \> Add New \> Upload screen in your WordPress dashboard. 3. Activate the plugin through the 'Plugins' menu in WordPress 4. Visit the settings screen and configure, as desired. Frequently Asked Questions -------------------------- = How can i redirect the user after success ? = You can use another plugin for that - Contact Form 7 Redirection <https://wordpress.org/plugins/wpcf7-redirect/> ### How can i set Extra parameters? You could set hidden fields for that <https://contactform7.com/hidden-field/> OR simply append the constant parameters to the url For example: <http://my-api-url?const1=some_value&const2=some_value> Changelog --------- ### 1.4.11 - Support to new CF7 version ### 1.4.10 - Add ability to override message with api response body (@Logikgate) ### 1.4.9 - Update flattening of acceptance fields to json boolean value - Add function to check if a field is an acceptance field - Convert array to csv (@NicoP-S) - support multiple file uploads (@NicoP-S) ### 1.4.8 - Revert handle single quotes ### 1.4.7 - Compatibility fixes ### 1.4.5 - Handle line breaks ### 1.4.4 - Extract custom placeholders from template ### 1.4.3 - Fixed bearer token Usage - Update WooCommerce plugin name ### 1.4.2 - Bug fix ### 1.4.1 - Support for WP 5 ### 1.3.0 - Add Basic Auth option ### 1.2.0 - Added better support for checkbox arrays and radio buttons - Added record filter to override record structure "cf7api\_create\_record" ### 1.1.1 - Fix version number ### 1.1.0 - Added send XML option. - Added send JSON option. - Added error log. - Debug log for each form - Debug log view changed - Debug log is now saved anyway ### 1.0.1 - Fix code errors and notices. ### 1.0.0 - Initial release.
All data under tab “API Integration” is not being saved. I tried different browsers, but all I got was “Contact form saved” and an empty form.
What could be the cause? “max_input_vars” is 1000.
cf7-to-api/includes/class-cf7-api-admin.php
Lines 358 to 369 in b9c4b71
This code is assuming that all valid form fields are known at design time.
the popular cf7 repeater plugin adds fields with an surfix of -1
quick fix/workaround
preg_match_all("/\[(\w+(-\d+)?)\]/", $properties['json_template'], $matches, PREG_PATTERN_ORDER);
$properties['wpcf7_api_data_map'] = array_merge(array_fill_keys($matches[1], ''), $properties['wpcf7_api_data_map']);
The plugin fails when you send double quote and backslash () in the contact form fields and you select the json option at the input type field of the API Integration plugin.
I think that the problem is that those characters are reserved in JSON and must be properly escaped to be used in strings.
Typo says 'Basic ' instead of 'Bearer '
Secondly on the same line, the API key that I submit does not need to be base 64 encoded, it is already in the correct format. I hacked the line locally as follows. Not elegant but it works... For some reason removing the encoding all together created other errors.
$args['headers']['Authorization'] = 'Bearer ' . base64_decode(base64_encode( $bearer_auth ));
Error code:
Warning: require_once(/u01/html/data-process-management/wp-content/plugins/cf7-to-api-basic-auth/class.cf7-api.php): failed to open stream: No such file or directory in /u01/html/data-process-management/wp-content/plugins/cf7-to-api-basic-auth/contact-form-7-api.php on line 49
** Also failed on plugin test for the same error message **
https://plugintests.com/plugins/cf7-to-api-basic-auth/latest
As a developer, I would like to be able to get the API response programmatically, be able to search for string within the response and take an action based on that (such as redirect to page based on response)
When sending to an API it doesn't handle response codes correctly.
For example if I send a sign up request to an API and that user already exists then the API should send back a 409 conflict code.
The plugin currently displays the correct text that is returned from the API
e.g.: 'The email address you have entered is already associated with another account.'
However it treats this as a success and clears the form. Rather than reading the 409 response as an error/failure and leaving the form as it is to be corrected by the user.
It would be awesome if the plugin would read error codes and react accordingly (I have only tested 409 so far)
I had a case where i had to increase the timeout on the code directly to 10
, would be very useful if we could set that on the config form.
Great work on this one, works great.
I've been using cf7-to-api successfully over the last year.
I have recently updated to CF7 5.3.2 and the API integration is no longer working?
Any ideas on how to resolve this?
Hello,
I have checked the File Upload with API connector but it is not been received it comes with the encryption data.. How can we send the file uploads to the APIs?
I have checked the other methods as well but it is not sending a file to the APIs.?
can you please verify it.
Re: https://wordpress.org/support/topic/custom-headers-12/
Hi kennym,
How to add Custom Headers? The thread was resolves but there was not guide to doing that.
Thank you.
I'm trying to integrated with marketo API and using following setting.
[https://[munchkinID].mktorest.com/identity/oauth/token/rest/v1/leads.json]https://[munchkinID].mktorest.com/identity/oauth/token/rest/v1/leads.json
Input type - JSON (We have tried Parameters - GET/POST also)
Method - POST
Some time its shows
[body] => {"requestId":"8dd7#176947dc2a7","success":false,"errors":[{"code":"1003","message":"Leads not specified"}]}
And some time its work but we are not able to see leads in marketo admin.
I have checked with marketo support team and they are not receiving any request. In postman API is working as expected.
Hello,
I am trying to get a form with multiple inputs posted to an API.
There is one file input in my form. My API receives a md5 sum or filename i think. Is it possible to get the file transferd to the api via POST multipart/form-data or something?
[image] => ffc8c6d6a1738d750f7cdfa5f1a12d29
I found the cf7 docs and it says:
How your uploaded files are managed#How your uploaded files are managed
After a user uploads a file through your contact form, Contact Form 7 checks to see if: 1.) Any PHP errors have occurred; 2.) the file type and file size are valid; and then, if the check turns out okay, Contact Form 7 moves the uploaded file to a temporary folder. At this point, Contact Form 7 attaches the file to the mail and sends it. After these procedures, Contact Form 7 then removes the file from the temporary folder.
https://contactform7.com/file-uploading-and-attachment/#How-your-uploaded-files-are-managed
If i check the folder it is empty..
Hi There,
When I create a checkbox, CF7-to-api seems to create its own tags that are in the format [name-checkboxlabel], however when I use those tags in my JSON, they never appear to resolve to anything but an empty string. Any idea what is happening?
As an aside, when i make the group of checkboxes a required field, it changes the way the tags are created, CF7-to-API only registers one tag which is just [name]. It doesn't seem like these two actions should be related.
This is whay my checkbox looks like in CF7:
[checkbox Budget "$750,000 - $999,999|280278" "$1,000,000 - $1,249,999|280279" "$1,250,000 - $1,499,999|280280" "$1,500,000 - $1,749,999|280281"]
It gives me tags like this:
[Budget-$750,000 - $999,999]
Am i using this wrong? or is there a bug?
Hi,
Thanks a lot for this plugin !
I'm trying to POST form data to a Yetiforce CRM (Open Source) using REST API.
https://doc.yetiforce.com/api/
Here's a working demo php script :
https://github.com/YetiForceCompany/YetiForceScripts/tree/master/YetiREST
As you may notice, the following parameters are required :
'apiPath' => 'https://gitdeveloper.yetiforce.com/',
'wsAppName' => 'portal',
'wsAppPass' => 'portal',
'wsApiKey' => 'VMUwRByXHSq1bLW485ikfvcC97P6gJsz',
'wsUserName' => '[email protected]',
'wsUserPass' => 'demo',
Does anybody knows how to add these extra parameters ?
Regards,
Special mail tags of wp cf7 are all empty:
https://contactform7.com/special-mail-tags/
Tested with [_serial_number] and [_post_id]
I am getting this error when I POST to https://chloe.insightly.services/Forms/xyz123...
The suggestion for this error is always to download the cacert.pem file from:
https://curl.haxx.se/docs/caextract.html
Editing /etc/php.ini to set the curl cainfo parameter like this.
[curl]
curl.cainfo="/etc/pki/tls/cacert.pem"
But I have done this and restarted httpd I still get the same cURL error 60 every time.
Any field containing double quotation marks breaks the api call, tried with 1.4.6, anyone having this issue? JSON Post is the method.
is it possible that i can't send emails too when the plugin activated?
Hi,
When I use [my-checkbox], and multiple values are checked, only the first item is parsed in the XML to the API with basic auth.
Any ideas on how to fix this ?
Is this plugin here better updated and supported then the mothballed version on Wordpress itself ( no author responses and no updates )?
Thanks
I installed the plugin and tried to activate it. But it's showing an error while activating.
Plugin could not be activated because it triggered a fatal error.
Fatal error: Cannot redeclare qs_cf7_textdomain() (previously declared in /../public_html/wp-content/plugins/cf7-to-api-basic-auth/contact-form-7-api.php:44) in /../public_html/wp-content/plugins/cf7-to-api/contact-form-7-api.php on line 43
Greetings,
There seems to be an issue with the latest CF& and being able to update, others have rolled back to resolve the issue but unfortunately, that is something we cannot do.
https://wordpress.org/support/topic/settings-not-saving-and-showing-up-as-blank/
Also, a possible feature request would be to instead of adding the form fields in the body of the post would it be possible to append the JSON object as a query parameter?
i ha tried this plugin, but i have the problem
i call with basic auth my crm and i setup the json in the plugin but i have returned this error.
error:
Array
(
[0] => WP_Error Object
(
[errors] => Array
(
[json-error] => Array
(
[0] => 4
)
)
[error_data] => Array
(
)
[additional_data:protected] => Array
(
)
)
)
json:
{"elementType":"Leads", "element": "{"company":"[text-301]","firstname":"[text-302]","lastname":"[text-303]","email":"[email-497]","phone":"[tel-497]","accounttype":"[menu-429]","cf_mke_1055":"[menu-874]","gdpr_privacypolicy":"[acceptance-5]","leadsource":"[lead_source]","cf_mke_1056":"[language]"}"}
Currently, if the form is filled up properly but an error occurs at the API side, the form still shows a 'success' message. Would be nice to be able to show the server error on the form if the API call fails.
Hi Dev Team,
Very nice plugin and useful. Thank you for your effort!
I want to report a bug, for the multiple select boxes on CF7, this plugin is not accepting the Array from the field. It is only passing the first element of the array via REST.
Example, if the field "Months" contains the array "[0]=> Jan, [1] => Feb, [2] => Mar", the plugin will only send "Jan" in the API call.
Hopefully, we can get this issue fix!
Thank you!
Regards,
Kenny C
Hi, how can i give custom messages based on api result?
i have 2 cases
thanks
Hi,
I'm trying 1.4.11
in API integration, using JSON, when I save, editor changes every " with ".
API call fails.
The plugin has started adding "/"'s in the JSON template every time the form is resaved after changes.
eg;
Original template:
{
"customer_name":"WP Update test",
"customer_billing_email":"[email protected]",
"customer_email":"[email protected]",
"customer_login":"astarisborn",
"customer_password":"somepasswordnotused",
"customer_dob":"1953-10-14",
"customer_street":"100 Devon Street East",
}
After save 1:
{
"customer_name":"WP Update test",
"customer_billing_email":"[email protected]",
"customer_email":"[email protected]",
"customer_login":"astarisborn",
"customer_password":"somepasswordnotused",
"customer_dob":"1953-10-14",
"customer_street":"100 Devon Street East",
}
After save 2:
{
\"customer_name\":\"WP Update test\",
\"customer_billing_email\":\"[email protected]\",
\"customer_email\":\"[email protected]\",
\"customer_login\":\"astarisborn\",
\"customer_password\":\"somepasswordnotused\",
\"customer_dob\":\"1953-10-14\",
\"customer_street\":\"100 Devon Street East\",
}
After save 3:
{
\\\"customer_name\\\":\\\"WP Update test\\\",
\\\"customer_billing_email\\\":\\\"[email protected]\\\",
\\\"customer_email\\\":\\\"[email protected]\\\",
\\\"customer_login\\\":\\\"astarisborn\\\",
\\\"customer_password\\\":\\\"somepasswordnotused\\\",
\\\"customer_dob\\\":\\\"1953-10-14\\\",
\\\"customer_street\\\":\\\"100 Devon Street East\\\",
}
etc.etc.
I'm in a bit of a panic, as an important project involving 4000 customers due to be deployed on Monday, started doing this today!! Help!!
Plugin 1.3.0 downloaded form WP org repo.
Warning: require_once(/home/xxxxx/public/wp-content/plugins/cf7-to-api-basic-auth/includes/class.cf7-api.php): failed to open stream: No such file or directory in /home/xxxxx/public/wp-content/plugins/cf7-to-api-basic-auth/contact-form-7-api.php on line 49
Fatal error: require_once(): Failed opening required '/home/xxxxx/public/wp-content/plugins/cf7-to-api-basic-auth/includes/class.cf7-api.php' (include_path='.:/usr/share/php') in /home/xxxxx/public/wp-content/plugins/cf7-to-api-basic-auth/contact-form-7-api.php on line 49
Fatal error: require_once(): Failed opening required '/home/xxxxx/public/wp-content/plugins/cf7-to-api-basic-auth/includes/class.cf7-api.php' (include_path='.:/usr/share/php') in /home/xxxxx/public/wp-content/plugins/cf7-to-api-basic-auth/contact-form-7-api.php on line 49
Hi. Thanks for your plugin!!
I've installed the plugin from Plugins - New plugin.
Unfortunately, when I click on Activate, it just keep disabled (no error is returned).
The plugin Contact form 7 to api + Basic auth v1.3.0 installed is this: https://es.wordpress.org/plugins/cf7-to-api-basic-auth/
I'm using WordPress 5.2.2 and Contact Form 7 Version 5.1.3
Note: I've also asked this question here: https://wordpress.org/support/topic/the-plugin-cannot-be-activated-on-wordpress-5-2-2/
Hi,
Thanks for this plugin.
I would like to use it with Jenkins.
Something I misunderstood.
URL to job:
JENKINS_URL/job/JOB_NAME/buildWithParameters?token=xxx&PARAMETERS=value&PARAMETERS=value&PARAMETERS=value
I need to put token for job (not for user authentification).
With this plugins I don't know how how to do that, because when I put token in base_url, others parameters appear like ?PARAMETERS=value
and not &PARAMETERS=value
and URL is wrong.
To avoid I need to put token in public form, not very good solution.
What is solution to let increment others parameters ?
And second problem for auth.
I need to put user:token in base_url instead of specific field basic auth.
When I put in basic auth field, not working.
Thanks!
Hey author,
The plugin works wonderful. But I have an issue with the plugin. I am using International Telephone Input for contact form 7 which uses mail tags to display the output. In the mail tag the shortcode works but it does not parses to api params instead it displays the same shortcode in the debug params. How can I resolve this? I know this plugin is only intended to work with CF7 but how can I achieve this to work with external plugin which are made to work with CF7 that can parse their shortcodes?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.