WordPress JavaScript Chat API Integration
Budget: $10 – $30 USD
I already have a WordPress site with a working JavaScript chat widget in place. What I still need is a clean, well-structured call to the Wordpress REST API that returns information from the database in JSON and a way to surface that data inside the widget in real time.
Here is the flow I envision:
1. Prior to the widget loading on the page, the script makes a REST call to my endpoint.
2. The code will dynamically read a value from the chatbot configuration and compare it to a value in the REST call to the Wordpress database.
3. The REST Call will ascertain the available credits in the data base and provide a outcome based on a comparison to a given number.
3. Your code parses that response and injects the relevant result as an alert if the process fails or if there is success the chatbot will load as normal.
The JavaScript for the widget is already bundled; you just need to plug in the fetch/axios logic, handle any errors gracefully, and keep everything fully compatible with WordPress best practices (enqueueing, no global conflicts, and so on).
Deliverables
• An addition to our current JS file which is stored on the website, that performs the REST call and updates the DOM elements in the chat widget. Also reference to where the function is located in the code
• Any minor PHP you deem necessary for WordPress (e.g., wp_localize_script for passing nonce or endpoint URL).
• Simple README with setup steps so I can replicate this on staging and production.
If you know your way around WordPress hooks, vanilla JS (or lightweight frameworks), and REST/JSON, this should be an efficient sprint. Let me know your approach and timeline, and I’ll get you access to the site details right away.
Here is the flow I envision:
1. Prior to the widget loading on the page, the script makes a REST call to my endpoint.
2. The code will dynamically read a value from the chatbot configuration and compare it to a value in the REST call to the Wordpress database.
3. The REST Call will ascertain the available credits in the data base and provide a outcome based on a comparison to a given number.
3. Your code parses that response and injects the relevant result as an alert if the process fails or if there is success the chatbot will load as normal.
The JavaScript for the widget is already bundled; you just need to plug in the fetch/axios logic, handle any errors gracefully, and keep everything fully compatible with WordPress best practices (enqueueing, no global conflicts, and so on).
Deliverables
• An addition to our current JS file which is stored on the website, that performs the REST call and updates the DOM elements in the chat widget. Also reference to where the function is located in the code
• Any minor PHP you deem necessary for WordPress (e.g., wp_localize_script for passing nonce or endpoint URL).
• Simple README with setup steps so I can replicate this on staging and production.
If you know your way around WordPress hooks, vanilla JS (or lightweight frameworks), and REST/JSON, this should be an efficient sprint. Let me know your approach and timeline, and I’ll get you access to the site details right away.