Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter phatza

    (@phatza)

    Hey @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_sent

    Hope it will help 🙂

    • This reply was modified 7 years, 7 months ago by phatza.
    • This reply was modified 7 years, 7 months ago by phatza.
    Thread Starter phatza

    (@phatza)

    Thanks for your reply 🙂

    I’m gonna check this further.

    Thanks a lot !

    Thread Starter phatza

    (@phatza)

    Hi @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,
    Regards

    • This reply was modified 7 years, 7 months ago by phatza.
    • This reply was modified 7 years, 7 months ago by phatza.
    Thread Starter phatza

    (@phatza)

    Hi @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

    • This reply was modified 7 years, 7 months ago by phatza.
    • This reply was modified 7 years, 7 months ago by phatza.
Viewing 4 replies - 1 through 4 (of 4 total)