# Setting up Okendo as your agnoStack Marketing Provider

Connect Okendo Reviews to Zendesk via agnoStack with your Okendo User ID and Merchant REST API Key, and optionally build a review moderation workflow with Shopify Flow and Zendesk.

![agnoStack Reviews Providers with Okendo selected and its User ID and API Password fields](https://go.agnostack.com/images/configuration/okendo/features-okendo-configuration.png)

*The Okendo configuration screen in agnoStack.*

[Okendo](https://okendo.com/) is available as an [Add-On Provider](https://agnostack.com/faqs/setup-onboarding/choose-optional-add-ons#add-on-providers) in agnoStack. With Okendo Reviews connected, agents see detailed [Okendo customer data](https://agnostack.com/release-notes/release-number/5-12-0/#new-add-on-providers---okendo--influencerio) in the agnoStack [Customer Insights](https://agnostack.com/release-notes/release-number/5-3-0/#zendesk-customer-insights) panel, and Okendo customer events in the agnoStack [Customer Timeline](https://agnostack.com/release-notes/release-number/5-9-0#customer-timeline), right inside each Zendesk ticket.

To connect Okendo, you'll need two values from the Okendo platform: your **User ID** and your **Merchant REST API Key**.

> **Note:** Beyond the Okendo Add-On setup, this guide also includes an optional example of an [advanced review approval and moderation workflow](#advanced-review-moderation) for retailers who want to get the most out of their Okendo integration.

## Okendo API Credentials

You'll generate your API credentials in the Okendo platform.

1. Make sure the [Okendo app](https://apps.shopify.com/okendo-reviews) is installed in your Shopify store.

   ![Okendo app listing in the Shopify App Store](https://go.agnostack.com/images/configuration/okendo/okendo-shopify-install.png)

   *The Okendo app for Shopify.*

2. From the Okendo app in Shopify, click **Open Okendo Platform** to log in to the [Okendo](https://okendo.com) admin.

   ![Okendo app landing screen with the Open Okendo Platform button](https://go.agnostack.com/images/configuration/okendo/okendo-integration-landing.png)

   *The Okendo app landing screen.*

3. In the left-hand navigation of the Okendo platform, click **Settings → Integrations**.
4. In the Integrations list, click the edit icon.
5. Click **Generate** (or **Show**) to reveal your API credentials.
6. Copy the **User ID** and the **Merchant REST API Key** and save them for later in the setup.

   ![Okendo Credentials with the User ID and Merchant REST API Key copy buttons](https://go.agnostack.com/images/configuration/okendo/okendo-integration-credentials.png)

   *Your Okendo integration API credentials.*

## Entering Your Credentials in agnoStack

In Zendesk, open the agnoStack configuration panel (via the **Manage Your Account** link or the agnoStack icon in the left sidebar) and select **Okendo** under **Reviews Providers**. Then enter the following:

| Field | Value |
| --- | --- |
| User ID | Your Okendo User ID |
| API Password | Your Okendo Merchant REST API Key |

Continue through the remaining configuration screens and click **Activate** to save your new Add-On configuration.

If you run into any trouble or need additional assistance, contact us any time at [support@agnostack.com](mailto:support@agnostack.com).

## Advanced Review Moderation

This optional workflow unlocks more of [agnoStack Customer Insights](https://agnostack.com/advanced-insights) with a review moderation pipeline across [Okendo](https://okendo.com/), [Shopify](https://shopify.com/) and [Zendesk](https://zendesk.com/), so retailers can handle reviews within Zendesk and boost agent efficiency and customer satisfaction. With it, you can:

- Automatically **convert Okendo reviews into Zendesk tickets** for easy management
- Respond to reviews directly, choosing to **make responses public or keep them private**
- **Approve or reject storefront reviews** directly from the [Order Timeline](https://agnostack.com/release-notes/release-number/2-2-0#order-timeline--order-notes--order-events)

The sections below walk through building the pipeline end to end, using [Shopify Flow](https://apps.shopify.com/flow), advanced Zendesk configuration and agnoStack Customer Insights.

![Okendo customer data in agnoStack Customer Insights](https://go.agnostack.com/images/configuration/okendo/features-okendo-customer-insights.png)

*Okendo in agnoStack Customer Insights.*

![Okendo review events in the agnoStack Customer Timeline](https://go.agnostack.com/images/configuration/okendo/features-okendo-customer-timeline.png)

*Okendo in the agnoStack Customer Timeline.*

> **Note:** To get the example code for every part of this workflow (the Shopify Flow steps and the Zendesk automations), contact [support@agnostack.com](mailto:support@agnostack.com?subject=Okendo%20review%20workflow).

## Zendesk API Token

Create a Zendesk API token for Shopify to use.

1. In the Zendesk Admin Center, click **Apps and integrations → APIs → Zendesk API**.
2. Click **Add API token** and name it *Okendo Reviews*.
3. Copy the **API Token** and save it for later in the setup.

   ![Zendesk Admin Center adding an API token](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-api-token.png)

   *Creating the Zendesk API token.*

## Encoding Your Zendesk Credentials

Your Zendesk API token is used in a new Shopify Flow, and Shopify needs it in an encoded form first.

1. Build a string from your Zendesk username (your email address) and the API token from the previous section, in this format:

   `YOUR_ZENDESK_LOGIN_EMAIL/token:YOUR_ZENDESK_API_TOKEN`

   Replace `YOUR_ZENDESK_LOGIN_EMAIL` and `YOUR_ZENDESK_API_TOKEN` with your own values.

2. Base64 encode the string.
3. Copy the encoded value and save it for later in the setup.

> **Note:** You can Base64 encode a string with Node/JavaScript in a [terminal window](https://betterstack.com/community/questions/how-to-do-base64-encoding-in-node-js/) or in your [browser console](https://developer.mozilla.org/en-US/docs/Web/API/Window/btoa).

## Zendesk Ticket Fields

The workflow uses two custom ticket fields in Zendesk.

1. In the Zendesk Admin Center, click **Objects and rules → Tickets → Fields**.
2. Create a new field of type **Text**, name it *Okendo Review ID*, and note its ticket field ID.
3. Create a second **Text** field, name it *Okendo Product ID*, and note its ticket field ID.

   ![Zendesk ticket fields with the Okendo Review ID and Okendo Product ID fields](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-ticket-fields.png)

   *The two custom ticket fields.*

## Shopify Metafields

The workflow also uses Shopify metafields. You create the metafield definitions and values with the [Shopify GraphQL Admin API](https://shopify.dev/docs/api/admin-graphql), which needs a Shopify access token with scopes for writing metafields.

### Creating Metafield Definitions

Use the following mutation to create each metafield definition:

```graphql
mutation metafieldDefinitionCreate($definition: MetafieldDefinitionInput!) {
  metafieldDefinitionCreate(definition: $definition) {
    createdDefinition {
      key
      name
      namespace
    }
    userErrors {
      field
      message
    }
  }
}
```

Create three metafield definitions: *Zendesk Field Review ID*, *Zendesk Field Product ID* and *Zendesk Subdomain*.

```javascript
// Example mutation payload for Zendesk Field Review ID
{
  "definition": {
    "ownerType": "SHOP",
    "key": "zendesk-field-review-id",
    "type": "single_line_text_field",
    "name": "Zendesk Field Review ID",
    "namespace": "agnoStack-metadata"
  }
}

// Example mutation payload for Zendesk Field Product ID
{
  "definition": {
    "ownerType": "SHOP",
    "key": "zendesk-field-product-id",
    "type": "single_line_text_field",
    "name": "Zendesk Field Product ID",
    "namespace": "agnoStack-metadata"
  }
}

// Example mutation payload for Zendesk Subdomain
{
  "definition": {
    "ownerType": "SHOP",
    "key": "zendesk-subdomain",
    "type": "single_line_text_field",
    "name": "Zendesk Subdomain",
    "namespace": "agnoStack-metadata"
  }
}
```

### Setting Metafield Values

Once the definitions exist, use the following mutation to set the three metafield values:

```graphql
mutation metafieldsSet($metafields: [MetafieldsSetInput!]!) {
  metafieldsSet(metafields: $metafields) {
    metafields {
      key
      type
      value
      namespace
    }
    userErrors {
      field
      message
    }
  }
}
```

Populate the values for *Zendesk Field Review ID*, *Zendesk Field Product ID* and *Zendesk Subdomain* by replacing the placeholders in the payload below. For the Review ID and Product ID, use the ticket field IDs from [Zendesk ticket fields](#zendesk-ticket-fields). You'll also need your Shopify Shop ID, which you can get from the Shopify API.

```javascript
// Example mutation payload for Zendesk Fields Review ID, Product ID and Subdomain
{
  "metafields": [{
    "namespace": "agnoStack-metadata",
    "ownerId": "gid://shopify/Shop/YOUR_SHOPIFY_SHOP_ID",
    "type": "single_line_text_field",
    "key": "zendesk-field-review-id",
    "value": "YOUR_REVIEW_ID_TICKET_FIELD_ID"
  }, {
    "namespace": "agnoStack-metadata",
    "ownerId": "gid://shopify/Shop/YOUR_SHOPIFY_SHOP_ID",
    "type": "single_line_text_field",
    "key": "zendesk-field-product-id",
    "value": "YOUR_PRODUCT_ID_TICKET_FIELD_ID"
  }, {
    "namespace": "agnoStack-metadata",
    "ownerId": "gid://shopify/Shop/YOUR_SHOPIFY_SHOP_ID",
    "type": "single_line_text_field",
    "key": "zendesk-subdomain",
    "value": "YOUR_ZENDESK_SUBDOMAIN"
  }]
}
```

## Shopify Flow

Next, use the Shopify Flow app to build a workflow that creates a Zendesk ticket whenever an Okendo review is created.

1. Make sure the [Flow](https://apps.shopify.com/flow) app is installed in your Shopify store.

   ![Shopify Flow app in the Shopify admin](https://go.agnostack.com/images/configuration/okendo/okendo-shopify-apps-flow.png)

   *The Shopify Flow app.*

2. In Flow, click **Create workflow → Select a trigger → Okendo Review Created → Okendo Review Created**.
3. At the top of the screen, name the workflow *Okendo Review Created*.

   ![Shopify Flow with the Okendo Review Created trigger](https://go.agnostack.com/images/configuration/okendo/okendo-shopify-flow-okendo-trigger.png)

   *The Okendo Review Created trigger.*

4. Below the **Okendo Review Created** step, click the plus (**+**) icon, choose **Action**, then choose **Flow → Run code**.

   ![Shopify Flow adding a Run code action](https://go.agnostack.com/images/configuration/okendo/okendo-shopify-flow-runcode-trigger.png)

   *Adding the Run code action.*

5. In the **Run code** editor, paste in the code for **Input**, **Output** and **Code**.
6. In the code, replace the word **Redacted** with your encoded Zendesk credentials from [Encoding your Zendesk credentials](#encoding-your-zendesk-credentials), then close the Run code step.

   ![Shopify Flow Run code configuration](https://go.agnostack.com/images/configuration/okendo/okendo-flow-run-code.png)

   *Configuring the Run code step.*

7. Below the **Run code** step, click the plus (**+**) icon, choose **Action**, then choose **Flow → Send HTTP request**.

   ![Shopify Flow adding a Send HTTP request action](https://go.agnostack.com/images/configuration/okendo/okendo-shopify-flow-runcode-trigger-http.png)

   *Adding the Send HTTP request action.*

8. Fill in all the details and close the step.

   ![Shopify Flow Send HTTP request configuration](https://go.agnostack.com/images/configuration/okendo/okendo-shopify-flow-runcode-trigger-http-config.png)

   *Configuring the first Send HTTP request step.*

9. Repeat once more: click the plus (**+**) icon on the **Run code** step, choose **Action**, then **Flow → Send HTTP request**. Fill in all the details and close the step.

   ![Shopify Flow second Send HTTP request configuration](https://go.agnostack.com/images/configuration/okendo/okendo-shopify-flow-runcode-trigger-http-config2.png)

   *Configuring the second Send HTTP request step.*

10. Click **Apply changes** to save the workflow.

    ![Completed Shopify Flow for Okendo reviews](https://go.agnostack.com/images/configuration/okendo/okendo-shopify-flow-complete.png)

    *The completed workflow.*

> **Note:** For the example code for the Run code and Send HTTP request steps, contact [support@agnostack.com](mailto:support@agnostack.com?subject=Okendo%20review%20workflow).

## Zendesk Macros

With the Shopify Flow in place, finish the setup in Zendesk, starting with two new macros.

1. In the Zendesk Admin Center, click **Workspaces → Agent tools → Macros**.
2. Create a macro named *Okendo Review - Private Reply* and fill in the details as shown below.

   ![Zendesk macro for an Okendo Review private reply](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-create-macro-private.png)

   *The private reply macro.*

3. Create a macro named *Okendo Review - Public Reply* and fill in the details as shown below.

   ![Zendesk macro for an Okendo Review public reply](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-create-macro-public.png)

   *The public reply macro.*

## Zendesk Webhook

Next, create a webhook for communicating with your Okendo platform.

1. In the Zendesk Admin Center, click **Apps and integrations → Webhooks**.
2. Click **Create webhook**, select **Trigger or automation** and click **Next**.

   ![Zendesk webhook creation with Trigger or automation selected](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-create-webhook1.png)

   *Choosing a Trigger or automation webhook.*

3. Fill in the details as shown below.

   ![Zendesk webhook configuration](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-create-webhook2.png)

   *Configuring the webhook.*

4. Click **Create webhook**, then **Finish setup**, then **Leave without connecting**.

   ![Zendesk webhook Finish setup](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-create-webhook3.png)

   *Finishing the webhook setup.*

   ![Zendesk webhook Leave without connecting](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-create-webhook4.png)

   *Leaving the webhook without connecting.*

## Zendesk Automations

Finally, create two Zendesk automations that send agent replies to the Okendo platform.

1. In the Zendesk Admin Center, click **Objects and rules → Business rules → Automations**, then click **Add automation**.

   ![Zendesk Automations with the Add automation button](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-add-automation.png)

   *Adding an automation.*

2. Create an automation named *Okendo Publish Review - Private*, fill in the details as shown below and click **Create**.

   ![Zendesk automation Okendo Publish Review - Private](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-create-automation-private1.png)

   *The private automation.*

   ![Zendesk automation Okendo Publish Review - Private, continued](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-create-automation-private2.png)

   *The private automation, continued.*

3. Create another automation named *Okendo Publish Review - Public*, fill in the details as shown below and click **Create**.

   ![Zendesk automation Okendo Publish Review - Public](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-create-automation-public1.png)

   *The public automation.*

   ![Zendesk automation Okendo Publish Review - Public, continued](https://go.agnostack.com/images/configuration/okendo/okendo-zendesk-create-automation-public2.png)

   *The public automation, continued.*

> **Note:** For the example code for both automations, contact [support@agnostack.com](mailto:support@agnostack.com?subject=Okendo%20review%20workflow).

## Support and Troubleshooting

If you have questions or run into issues setting up the Okendo review workflow, contact us any time at [support@agnostack.com](mailto:support@agnostack.com?subject=Okendo%20review%20workflow). We're always happy to walk through and troubleshoot it together with you, and we try to make ourselves available across time zones.
