phatza
Forum Replies Created
-
Forum: Plugins
In reply to: [Contact Form 7] Using WP REST API in Nodejs APPHey @takayukister !
I figured it out ! 🙂 🙂
I had to use FormData Javascript Class to parse correctly my data before sending them to the CF7’s form.
// Create new instance let bodyFormData = new FormData() // Set key:value pair according to your input:value form's fields bodyFormData.set( 'key', 'value' ) // Request containing url, data, Object (containing headers for example) axios.post('https://domain-name/wp-json/contact-form-7/v1/contact-forms/ID/feedback', bodyFormData, { headers: { Authorization: 'Bearer tokenKey' ) } }) .then((res) => { console.log(res.data) }) }And it returns:
into: "#" message: "Thanks for your message. It has been sent" status: "mail_sentHope it will help 🙂
Forum: Plugins
In reply to: [Contact Form 7] Using WP REST API in Nodejs APPThanks for your reply 🙂
I’m gonna check this further.
Thanks a lot !
Forum: Plugins
In reply to: [Contact Form 7] Using WP REST API in Nodejs APPHi @takayukister 🙂
Can you confirm that the right ROUTES/ENDPOINT for submitting data to my wordpress CF7’s form (and then send email) is the following one :
/contact-form-7/v1/contact-forms/(?P<id>\d+) ?Do you have documentation about the JSON structure of CF7’s endpoints ?
Thanks a lot,
RegardsForum: Plugins
In reply to: [Contact Form 7] Using WP REST API in Nodejs APPHi @takayukister !
Thanks for your reply 🙂In the response I also got :
invalidFields: Array(3) 0: {into: "span.wpcf7-form-control-wrap.yourName", message: "Ce champ est obligatoire.", idref: null} 1: {into: "span.wpcf7-form-control-wrap.yourCompany", message: "Ce champ est obligatoire.", idref: null} 2: {into: "span.wpcf7-form-control-wrap.yourEmail", message: "Ce champ est obligatoire.", idref: null}The fields seem to be invalid because they may not being populated by my request.
I’m not really sure how exactly pass the right values to CF7’s remote form.Regards,
PS: the form is already created and works fine within WordPress