Integrate the Zendesk Bot with WooCommerce

Step-by-step guide to integrating the Zendesk bot with WooCommerce using the WooCommerce API

How to Integrate the Zendesk Bot with WooCommerce Using the API

Bot screenshot

Automating customer support is key to saving time and improving user experience. By integrating the Zendesk bot with WooCommerce, WooCommerce powered e-commerce sites can give a better service to their customers and save time and effort to their customer support agents.

This integration is an example on how WooCommerce powered e-commerce sites can use the WooCommerce API and the Zendesk bot capabilities to grab information from the user and send it to WooCommerce so it can act accordingly. In this case, we will simply give a message depending on the status order; however, the posibilities are endless.

This guide provides a detailed step-by-step tutorial for web developers and Zendesk administrators to do just that. Let’s get started!

 

Contact us if you have queries

Setting up a Zendesk conversational bot, and Zendesk in general can be pretty difficult in practice. Contact us if you get stuck; we will be glad to help.

 

Steps to Integrate the Zendesk Bot with WooCommerce

  1. Create a REST API Key in WooCommerce

    WooCommerce REST API screenshot

    To enable the Zendesk bot to interact with your WooCommerce store, you need to generate a REST API Key. This API Key allows secure communication between WooCommerce and the Zendesk bot. Follow these steps to create the key:

    1. Log in to your WordPress dashboard and navigate to WooCommerce > Settings.
    2. In the Settings menu, click on the Advanced tab, located at the top of the page.
    3. Select REST API from the menu options on the left-hand side.
    4. Click the Add Key button to create a new API Key.
    5. Fill out the fields in the "Add Key" form:
      • Description: Enter a name for the key, such as "Zendesk Bot Integration."
      • User: Select the admin user under whose permissions the key will operate.
      • Permissions: Set this to Read/Write. This ensures that the bot can both retrieve and update order details if needed.
    6. Click Generate API Key. WooCommerce will create a Consumer Key and a Consumer Secret.
    7. Copy both the Consumer Key and Consumer Secret. These will be used to authenticate the Zendesk bot when making API calls.
    8. Save the keys in a secure location. For security purposes, WooCommerce will not display the keys again once you leave this page.

    Your REST API Key is now ready to use. This key will be the foundation for connecting WooCommerce to the Zendesk bot and enabling it to perform order lookups.

  2. Connect the Zendesk Bot to WooCommerce Using API Credentials

    Once you have your WooCommerce REST API Key (Consumer Key and Consumer Secret), the next step is to establish a secure connection between the Zendesk bot and WooCommerce. This connection enables the bot to make API calls to retrieve order details. Follow these steps:

    Conections in the Zendesk Admin Center

    1. Log in to your Zendesk Admin Center.
    2. Go to Apps and integrations > Connections > Connections, then click on Create connection.
    3. In the connection setup screen:
      • Connection Name: Enter a name such as "WooCommerce API Integration."
      • Authentication Type: Select Basic Authentication.
      • Username: Enter your WooCommerce REST API Key (from Step 1).
      • Password: Enter your WooCommerce REST API Secret (also from Step 1).
      • Allowed domain: Enter your site URL.
    4. Save the connection. Zendesk will now use this connection to authenticate API calls made by the bot.

    By completing this step, you’ve set up a secure bridge between the Zendesk bot and WooCommerce, allowing the bot to interact with WooCommerce’s API.

  3. Create a Custom Zendesk Ticket Field Called "Order Number"

    To allow the Zendesk bot to collect the user's order number and pass it to WooCommerce via the API, you need to create a custom ticket field in Zendesk. This field will store the user-provided order number and be referenced during the bot’s interaction. Follow these steps:

    Creating a field in the Zendesk Admin Center

    1. In your Zendesk Admin Center, navigate to Objects and Rules > Tickets > Fields.
    2. Click the Add Field button to create a new ticket field.
    3. Configure the ticket field with the following details:
      • Field Type: Select Text (single line). This is the most appropriate type for capturing short inputs like an order number.
      • Display Name: Enter Order Number. This title will be displayed in the ticket form and referenced later by the bot.
      • Permissions: Customers can edit. I you do not set this permissions, your customers will not be able to interact with your bot.
    4. Save the ticket field. It will now appear in your list of ticket fields.

    By creating this custom ticket field, you provide a way for the Zendesk bot to collect the user's order number, which it will use to query WooCommerce.

    If you already have an order number ticket input, you can use it instead of creating a new field, provided that if the permissions are set on "Customers can edit".

  4. Add a Bot Response Named "Order State"

    The next step is to define a bot response in Zendesk that handles the customer’s request for their order status. This response will serve as the starting point for the bot workflow that retrieves and displays the order details. Follow these steps:

    Workflow in the Zendesk Admin Center

    1. Navigate to Channels > AI Agents (or Bots) and click on Manage conversation bots. The edit the bot you want to update or create a new one.
    2. Go to the Answers section. This is where you define pre-configured responses for common customer queries.
    3. Click the Create Answer button to create a new bot response.
    4. Configure the appropiate intents, like "order status", "followup information", "when will the order be sent", "when will the order be received"

    By adding this "Order State" bot response, you create a starting point for the workflow that retrieves the order status. This step is critical for directing the customer to the next steps in the bot's interaction.

  5. Add an "Ask for Details" Step in the Zendesk Bot

    In this step, you will configure the Zendesk bot to prompt the customer for their order number. This input will be linked to the custom ticket field you created earlier ("Order Number"). The bot will use this value in subsequent API calls to retrieve the order details. Follow these steps:

    1. Add a new step to the workflow by clicking the Add Step button. Select Ask for Details as the type of step.
    2. Configure the "Ask for Details" step with the following details:
      • Name: Add something like "Ask for order number"
      • Fields: Select the custom ticket field you created earlier, labeled "Order Number." This links the customer’s input to the ticket field.

    By adding this "Ask for Details" step, the Zendesk bot will include a form to collect the required information from the customer (i.e., their order number).

  6. Add a "Make an API Call" step in the Zendesk bot
    • HTTP Method: GET
    • Endpoint URL: https://yourstore.com/wp-json/wc/v3/orders/{{ticket_field}} You must select the ticket field by clicking on the {+} icon.
    • Authentication: Use your Zendesk bot API connection

    After setting up, click "Make API Call" and test it using a valid order number. If the call is successful, you’ll see the order object returned by WooCommerce.

    Then save the order status as a variable for use in the next steps.

  7. Handle API Call Response with Conditional Logic

    After making the API call to WooCommerce, the bot needs to handle the response, check the order status, and provide a suitable message to the user. In this step, you'll set up conditional logic to determine the order's status and display appropriate messages based on whether the order is still pending or has been processed. Here’s how to configure the bot’s response:

    1. In the workflow editor, locate the "Make an API Call" step you configured in Step 6. This is where you will add the conditional logic to handle the API response.
    2. Add a new step to the workflow by clicking the Add Step button and selecting Branch by condition from the available options.
    3. Configure the branching logic:
      • Click on Add Branch and give it a name like "Status is pending".
      • Edit the new branch.
      • Add a condition: status Contains Pending

    By adding this conditional branching logic, you enable the Zendesk bot to check the order status returned from the WooCommerce API and provide a tailored response. The bot will now inform the user whether their order is still pending or has already been processed, based on the dynamic data retrieved from WooCommerce.

  8. Add Custom messages

    Once you have created the conditions, you need to handle them. We will do it by simply adding messages to the user:

    1. In the workflow editor, under the "Status is pending" statement, add a new step of type Message with text "Your order is still pending".
    2. In the workflow editor, under the "Else" statement, add a new step of type Message with text "Your order status is " and add the status variable by clicking on {+}.

    You do not need to add messages. You can also transfer to an agent, or do any other action you need to do.

  9. Click Done, then test the bot by clicking on Test AI agent (or bot). Once you do that, click Publish AI Agent so the bot is available for use.

 

Contact us if you have queries

As you see, the process can be quite complex and cumbersome in real life. Contact us if you get stuck; we will be glad to help.

 

Conclusion

Integrating the Zendesk bot with WooCommerce using the WooCommerce API is an effective way to automate order queries and enhance your customer support system. This Zendesk WordPress integration not only simplifies bot order retrieval but also ensures your customers receive timely updates about their orders.

By following the steps outlined in this guide, you’ll be able to set up a bot that retrieves order details, notifies users about pending orders, and confirms processed statuses—all with minimal effort. If you need further assistance, refer to the official WooCommerce REST API documentation and Zendesk support resources.

Contact us for more information.

By working with us, you will benefit from:

15+ years implementing CRM and CX solutions
15+ years building apps and integrations
Former Zendesk® employees
Specialised Partner. We only work with Zendesk® as CRM / CX solution.
Certification in Zendesk® Suite, Sunshine Conversations, and Sell
Zendesk® training and best practices for administrators and users
Agile procedures for evaluating, implementing, and developing
Flexibility in the way of working and speed in the face of incidents
Multiple references and focus on the satisfaction of our customers

Schedule my consultation

Schedule my FREE 15 minute consultation
We will never share your info with anyone