---
title: Yotpo
slug: yotpo
docTags: 
createdAt: 2022-07-27T19:58:38.000Z
---



:::ExpandableHeading{isOpen="true"}
### Introduction

This document will walk through integrating Chord's OMS with Yotpo. Once you integrate, your customers will be able to use a powerful data-driven tools that makes it very easy for your customers to provide their feedback so you can transform every purchase made into a review.


:::



:::ExpandableHeading{isOpen="true"}
### What is Yotpo

The Yotpo destination function is used to sync completed orders from the Chord's OMS platform to Yotpo to be able to collect higher-quality reviews addressing high-converting topics that actually inspire purchases and grow your business&#x20;

For more information about Yotpo and custmizing the request flows please refer to their document [here](https://support.yotpo.com/en/article/creating-a-review-request-premium-enterprise)


:::

:::ExpandableHeading{isOpen="true"}
### Creating the function

Before starting the creation of the function ensure that you are using the correct code template. There are two different code templates for [Autonomy](https://github.com/chordcommerce/segment-functions/blob/main/destinations/yotpo-autonomy/index.js) vs [Performance](https://github.com/chordcommerce/segment-functions/blob/main/destinations/yotpo-performance/index.js) customers. It is important to choose the right one.

Copy the correct code&#x20;

Navigate to Segment and click Catalog -> Functions -> New Function



![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/5yqyVsByw_31SELGs438W_image-10-4-2022-at-1040-am.jpg "New Function ")



Select "Destination Function" and click Build&#x20;

Paste in the function code from above

![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/akw9ZWt0q02TocpHqE1mm_image-10-4-2022-at-1055-am.jpg "Function Type - Destination")



and click Settings - Add Setting

Label = apikey

Name = apikey

Unanmed = \<apikey> (found in Yotpo settings)

Click **Add Setting**

![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/DDXTSLOx6zyThwmXFB_FF_image-10-4-2022-at-337-pm.jpg "Adding Setting")





Label = secretkey

Name = secretkey

Unamed = \<secretkey> (found in Yopto settings)

Click **Add Setting**

![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/rhdCDrANUPzxgW-cadGEx_image-10-4-2022-at-344-pm.jpg)



Label = secretkey

Name = secretkey

Unamed = \<secretkey> (found in Yopto settings)

Click Array&#x20;

In the First Item event field paste **Order Completed**

Remove Second and Third Item fields

Click **Add Setting**

![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/4ux8VJVTpYnyHPaHrkLOU_image-10-4-2022-at-357-pm.jpg "Events Setting")



Click Configure&#x20;

Provide a Name, we recommend **Yotpo Function**

Provide a Description, and even a logo and click create Function

![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/A8d8RnW56Nn07krd-lLWV_image-10-4-2022-at-406-pm.jpg "Creating Function")


:::

::::ExpandableHeading{isOpen="true"}
### Connect Function to Source

Your Function has been created!&#x20;

Click **Connect Destination**

![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/8R8opOV4AfB0jX2frZFbq_image-10-4-2022-at-614-pm.jpg "Connecting the Destination")

For Autonomy customers, the destination function should be connected to the **Ruby back-end source**.

![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/auXfcHtjZ7IlsN7xTutul_image-10-4-2022-at-630-pm.jpg "example of Ruby autonomy back-end")

For Performance customers, the destination function should be connected to the **Javascript front- end source**.

![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/ibn6ZoOD3uJnjjassodZn_image-10-4-2022-at-632-pm.jpg "example of JS Performance front-end")



When you connect the destination function, you'll need to provide values for the settings you configured above.&#x20;

Select your Destination and click Next&#x20;

Provide a Destination Name, we recommend something like "Yotpo Production" Click Save

Enter the Yotpo API key and secret key (found in the Yotpo admin), and Order Completed for the events setting.&#x20;



:::hint{type="info"}
Make sure to enable the function
:::
::::

::::ExpandableHeading{isOpen="true"}
### Verify your Function

You can test that the function is working correctly in the "Event Tester" tab.

You'll need an example event, so find (or place a test order) a recent **Order** **Completed** event in the Segment Debugger for the source that you connected to the Yotpo function, and copy the entire event JSON from the "Raw" tab:

![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/I0Yvf_22Yzg_4pp53y9wI_image-10-5-2022-at-859-am.jpg "Order Completed Debugger")

Navigate to the "Event Tester" tab of the Yotpo destination function you just created, and replace the dummy JSON with the event JSON you copied:

![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/l-usVHaeU7cUjPUT5zg3U_image-10.png "Event Tester")





:::hint{type="danger"}
The order from the Order Completed event you copied will be synced to Yotpo, so if Yotpo is configured to send automatic review requests, the customer will receive one.


:::

Hit "Send Event" and make sure you see a 200:

![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/l9uGJxz6kPvJMpP4PJMhZ_image-11.png "Event Lifecycle")



:::ExpandableHeading{isOpen="true"}
### Verify API Order&#x20;

If you would like to query the Yotpo API to see what orders have been submitted from the function, here's how:

- **Get an access token**

Populate the API\_KEY and the SECRET\_KEY in the code snippet:



<font color="#3b9f0f">curl --request POST \\</font>

<font color="#3b9f0f">     --url https\://api.yotpo.com/core/v3/stores/API\_KEY/access\_tokens \\</font>

<font color="#3b9f0f">     --header 'Accept\: application/json' \\</font>

<font color="#3b9f0f">     --header 'Content-Type\: application/json' \\</font>

<font color="#3b9f0f">     --data '\{ "secret"\: "SECRET\_KEY" \}'</font>





Copy the `access_token`from the output and use it in the next step.

- **Get the list of orders**

Populate the API\_KEY and the TOKEN (from access\_token above) in the code snippet:

<font color="#3b9f0f">curl --request GET \\</font>

<font color="#3b9f0f">--url https\://api.yotpo.com/core/v3/stores/API\_KEY/orders \\</font>

<font color="#3b9f0f">--header 'Accept\: application/json' \\</font>

<font color="#3b9f0f">--header 'Content-Type\: application/json' \\</font>

<font color="#3b9f0f">--header 'X-Yotpo-Token\: TOKEN'</font>













You should get a JSON list of orders from Yotpo.



Your connection is now successfully created!&#x20;
:::




::::

