2

I'm trying to build a wp theme in React.. Is there any way to use contact form 7 plugin in react using wordpress rest-api

Jvin Mahmoud
  • 23
  • 1
  • 3
  • I don't think that Contact Form 7 provide endpoint for sending mails, but you can use something like this https://gist.github.com/nandomoreirame/5966bc4b12588904c214277328ba701a to trigger sending emails from ReactJS app. – Janiis Jun 30 '19 at 16:28

1 Answers1

2

you should be able to get the form data trough the rest api by requesting the correct post ID, and then parse the tags yourself, or you could probably also create your own endpoint that returns the generated HTML.

If you are looking for a way to post the form, you need to post the data to this endpoint: http://www.yourdomain.com/wp-json/contact-form-7/v1/contact-forms/FORM-ID/feedback

It's explained pretty clearly here: https://medium.com/@mahesh_joshi/wordpress-contact-form-7-rest-api-endpoints-bf45907b571c

Jules Colle
  • 11,227
  • 8
  • 60
  • 67