Giter Club home page Giter Club logo

cf7-to-api's Introduction

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.


cf7-to-api's People

Contributors

chrisolesen avatar kennym avatar logikgate avatar mariovalney avatar ncs-thomas avatar nicop-s avatar zetanova avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cf7-to-api's Issues

File Upload is not working

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.

Handle API errors

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.

Hardcoded parameters in Called URL & Auth

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!

Checkbox tags not working

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?

Plugin could not be activated due to fatal error

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

Need examples of API CALL?

Hello Kennym,
I'm very happy to use this ambitious plugin.
But I need examples to write API CALLS.
Do you have cases with input type = "Parameters-GEST-POT" or "json" ?
My need is to add events (tribe) from a front-end form.
api_integration
last-api-call

Error line 595 of class-cf7-api-admin.php

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 ));

The plugin cannot be Activated on WordPress 5.2.2

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/

New version not passing short code values

Hello
Please refer to the image. The short code values of the plugin "International Phone Number" are not getting pulled in the new version. in the old version they were working fine. Can you please check and advise where can I find older version of the plugin. thanks

Screen Shot 2021-04-22 at 12 48 03 PM

[feature] Timeout custom

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.

Doesn't handle 409 response codes correctly

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)

file input to API

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..

Could not parse external plugin shortcode to api

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?

How to pass other authentication parameters ?

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,

checkbox: multiple values not parsed

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

cf7 repeater fields

public function qs_save_contact_form_details( $contact_form ){
$properties = $contact_form->get_properties();
$properties['wpcf7_api_data'] = isset( $_POST["wpcf7-sf"] ) ? $_POST["wpcf7-sf"] : '';
$properties['wpcf7_api_data_map'] = isset( $_POST["qs_wpcf7_api_map"] ) ? $_POST["qs_wpcf7_api_map"] : '';
$properties['template'] = isset( $_POST["template"] ) ? $_POST["template"] : '';
$properties['json_template'] = isset( $_POST["json_template"] ) ? $_POST["json_template"] : '';
$contact_form->set_properties( $properties );
}

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']);

Changes " with \"

Hi,
I'm trying 1.4.11
in API integration, using JSON, when I save, editor changes every " with ".
API call fails.

Custom message based on api response

Hi, how can i give custom messages based on api result?

i have 2 cases

  1. the api service is not available.
    the redirect page is set to go to the success page regardless of the api response
  2. if the sesponce from api has errors that the user need to fix how can i pass this messages back to the form?

thanks

Form is not saved

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.

Bug Report - API Call not accepting Array Value

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

adding "/" each time the form is saved

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 error send json option

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.

API call not working.

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.

MicrosoftTeams-image

Blank parameters

Since CF7 version 5.4 the parameters form is totally blank and if parameters are inserted, on saving everything is cleaned. I don't know honestly if inserted values are stored or not, and in that case it would be a simple issue of displaying the correct values

Schermata 2022-04-04 alle 12 20 28
.

Error with post json

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]"}"}

Cannot redeclare qs_cf7_textdomain()

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

Handle API Response

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.