Yotpo Loyalty 1.0
Yotpo Loyalty is a platform that allows to build customized rewards and referrals programs to engage existing customers and reach new ones.
OverviewCopy
Yotpo Loyalty and Referrals (formerly Swell Rewards) allows brands to build tailored, customer-centric loyalty and referral programs that increase lifetime value and drive new customer acquisition. Build a program unique to your brand and KPIs using configurable point-earning campaigns, tiered VIP perks, customizable rewards options, and more using our enterprise-grade software.
API INFO: The Base URL used for the Yotpo Loyalty connector is https://loyalty.yotpo.com/api/v2. More information can be found on their main API documentation (v2.0) site.
AuthenticationCopy
When using the Yotpo Loyalty connector, the first thing you will need to do is go to your Tray.io account page and select the workflow you wish to work on. Once in the workflow builder itself, search and drag the Yotpo Loyalty connector from the connectors panel (on the left-hand side) onto your workflow.
With the new Yotpo Loyalty connector step highlighted, in the properties panel on the right, click on the Authenticate tab and 'Add new authentication' (located under the 'Authentication' field).
This will result in a Tray.io authentication pop-up window. The first page will ask you to name your authentication and state which type of authentication you wish to create ('Personal' or 'Organisational').
As you can see, the next page asks you for your 'GUID' and 'API Key' credentials.
In order to get these fields, head to your Yotpo Loyalty dashboard. You will find the 'GUID' and 'API Key' under the 'Settings' page.
Once you have added these fields to your Tray.io authentication pop-up window, click on the 'Create authentication' button.
Go back to your settings authentication field (within the workflow builder properties panel), and select the recently added authentication from the dropdown options now available.
Your connector authentication setup should now be complete.
Available OperationsCopy
The examples below show one or two of the available connector operations in use.
Please see the Full Operations Reference at the end of this page for details on all available operations for this connector.
NEED A TRIGGER?: Remember that as a user you can always create your own service trigger should you require one. Check out the Webhook Trigger documentation page for more details.
Using the Raw HTTP Request ('Universal Operation')Copy
As of version 1.0, you can effectively create your own operations.
This is a very powerful feature which you can put to use when there is an endpoint in Yotpo Loyalty which is not used by any of our operations.
To use this you will first of all need to research the endpoint in the Yotpo Loyalty API documentation v2, to find the exact format that Yotpo Loyalty will be expecting the endpoint to be passed in.
Note that you will only need to add the suffix to the endpoint, as the base URL will be automatically set (the base URL is picked up from the value you entered when you created your authentication).
The base URL for Yotpo Loyalty is: https://loyalty.yotpo.com/api/v2
.
For example, say that the 'Get customer' operation did not exist in our Yotpo Loyalty connector, and you wanted to use this endpoint, you would use the Yotpo Loyalty API docs to find the relevant endpoint - which in this case is a GET
request called: /customers
.
More details can be found here.
As you can see, there is also the option to include a query parameter, should you wish to do so. So if you know what your method, endpoint, and details of your query parameters are, you can get the information with the following settings:
Method: GET
Endpoint: /customers
Query Parameter: Key: customer_email
Value: test001@tray.io
Body Type : none : { "none" : null }
Final Example outcome being: https://loyalty.yotpo.com/api/v2/customers?customer_email=test001@tray.io
Example UsageCopy
TRAY POTENTIAL: Tray is extremely flexible. By design there is no fixed way of working with it - you can pull whatever data you need from other services and work with it using our core and helper connectors. This demo which follows shows only one possible way of working with Tray and the Yotpo Loyalty connector. Once you've finished working through this example please see our Introduction to working with data and jsonpaths page and Data Guide for more details.
Below is an example of a way in which you could potentially use the Yotpo Loyalty connector to retrieve a customer record. Most commonly used to fetch a customer's point balance and unique referral link.
The steps will be as follows:
Setup using a manual trigger and list all the customers who were updated in the last seven days.
Loop through the received list of customers.
Retrieve the details of each customer record.
The final outcome should look like this:
1 - Setup trigger & List recently updated customersCopy
Once you have clicked 'Create new workflow' from your main Tray.io dashboard named it, select the 'Manual trigger' from the trigger options available:
After you have been redirected to the Tray.io workflow dashboard, from the connectors panel on the left, add a Yotpo Loyalty connector to your second step. Set the operation to 'Raw HTTP Request'.
Feel free to re-name your steps as you go along to make things clearer for yourself and other users.
Upon completion, you will have set up the manual trigger and fetched a list of all the customers who were updated in the last seven days.
2 - Loop collectionCopy
Next, search for the Loop collection connector within your connector panel, and drag it into your workflow as your next step. Set your operations to 'Loop Collection'.
The Loop Collection connector allows you to iterate through a list of results. In this example, we will use it to iterate through the data found within the previous 'List Updated Customers' connector step.
In order to specify the list you want to loop through, start by using the 'List' mapping icon (found next to the list input field, within the properties panel) to generate the connector-snake.
While hovering over the 'List Updated Customers' step (with the tail end of the connector-snake), select response.body.customers
from the list of output properties displayed. This will auto-populate a jsonpath within your 'List' input field and update the type selector to jsonpath.
For more clarification on the pathways you have available, open the Debug panel to view your step's Input and Output.
JSONPATHS: For more information on what jsonpaths are and how to use jsonpaths with Tray, please see our pages on Basic data concepts and Mapping data between steps
CONNECTOR-SNAKE: The simplest and easiest way to generate your jsonpaths is to use our feature called the Connector-snake. Please see the main page for more details.
Now, you will be able to loop through the list of the recently updated customers you have fetched in the first step.
3 - Get customer detailsCopy
The last step is to drag a Yotpo Loyalty connector inside of the Loop Collection step itself. Set the operation to 'Get customer'. As you can see, the 'Customer identifier' field is required.
Select the type of 'Customer identifier' from the available drop-down options.
Based on the selected customer identifier, use the connector snake and hover over the 'Loop Collection' step (with the tail end of the connector-snake) and select the jsonpath for the specified identifier from the list of output properties displayed.
In this case the jsonpath for 'Customer email' identifier is selected and it should appear simillar to $.steps.loop-1.value.email
.
INTERPOLATION: When you wish to include JSON generated data within another input/output result, use our Interpolation method as described here.
You can always inspect the [logs of your workflow] (/platform/troubleshooting/logs-and-debugging/) by using the ‘Debug’ tab available on the top of the Tray builder.
If you go through each execution of the 'Get Customer' step, you will see the results of each loop.
BEST PRACTICES: Whenever you do decide to create your own workflow, be sure to check out some of our key articles such as: