Hello Magento Friends,

In today’s blog, I will guide you on How to Submit Contact Us Data using GraphQL API in Magento 2.

In Magento 2, the GraphQL API provides a powerful way to interact with the platform programmatically. Utilizing this feature, you can easily submit contact us data, thereby enabling a seamless and efficient communication channel between your customers and your business.

Let’s find out How to Submit Contact Us Data using GraphQL API in Magento 2.

Steps to Submit Contact Us Data using GraphQL API in Magento 2:

Step 1: First, we need to create a “schema.graphqls” file inside the etc folder

app\code\Vendor\Extension\etc\

Then add the code as follows

Step 2: After that, create the “Contactusgraphql.php” file inside the Resolver folder.

app\code\Vendor\Extension\Model\Resolver\

Now include the below-mentioned code

Step 3: After that, we need to create the “Contactus.php” file inside the extension at the following path

app\code\Vendor\Extension\Model\Resolver\DataProvider\

And add the following code snippet

Step 4: Run the upgrade command and compile command, and then pass the query like the below in the server

Output:

Submit Contact Us Data using GraphQL API in Magento 2

Conclusion:

By following the steps outlined in this guide, you can effectively leverage the Magento 2 GraphQL API to submit contact us data. This capability enables you to streamline the communication process and provide an enhanced user experience for your customers. Leveraging the power of GraphQL in Magento 2 allows for a more efficient and seamless data submission process.

If you face any difficulty in submitting contact us data using the GraphQL API, you can connect with me through the comment section. You can also Hire Magento Developer if you find difficulty working with GraphQL API.

Happy Coding!

Click to rate this post!
[Total: 0 Average: 0]