WordPress Contact Form 7 Rest API endpoints
By the end of this tutorial, you will be able to collect emails that are send by the frontend users to your email box ( eg: abc@gmail.com )using contact form 7 rest api.
Let’s get started from backend wordpress.
Step 1: If you haven’t installed wordpress yet, then follow this link. https://wordpress.org/support/article/how-to-install-wordpress/ Otherwise, just skip this step.
Step 2:
Go to : Plugins → Add New
Search Plugin → Contact form 7
Install it. Activate it.
Click contact form. You will see something like this.
Now, Click tab: Mail
Edit To: {with you email address}
That’s all.
Let’s move to API section.
I am using insomnia rest client to make post request to backend wordpress server. You can use any other like PostMan. Or you may use axios from frontend using React, Vue, Angular etc.
Method: POST
http://www.yourdomain.com/wp-json/contact-form-7/v1/contact-forms/358/feedback
Replace
- www.yourdomain.com →with your domain name
- 358 → This is contact form 7 id. for eg: [contact-form-7 id=”358" title=”Contact me”]. You will see this, once you install contact form 7 in your wordpress backend.
Note: Don’t forget to use multipart Form
RESPONSE:
{
"into": "#",
"status": "mail_sent",
"message": "Thank you for your message. It has been sent."
}
Conclusion:
Congratulation, You should now receive user emails to your email box.
Related Tag are :
- contact form 7 api integration
- wordpress rest api contact form
- how to use contact form 7 to api
- contact form 7 send data to api