Reward Using Trigger
You can use Nector APIs to reward your customers when certain actions are performed. Rewarding via API is done through a trigger.
A trigger holds the logic and conditions for rewarding. Read this article to learn more about triggers: https://nector.crisp.help/en/article/what-are-triggers
Before you can start using the APIs, create a trigger.
To reward wallet coins to your customers, you need to create a wallet based trigger, to learn how to create one, read here: https://nector.crisp.help/en/article/how-to-create-a-wallet-trigger
To reward a discount directly, you must create a offer based trigger, to learn how to create one, read here: https://nector.crisp.help/en/article/how-to-create-a-offer-trigger
This article is for explaining how to use Triggers for rewarding through APIs.
If the trigger is to be used in the frontend directly, make sure to mark it as Open so that it can called from a Read Only API Key
Once you have created the Trigger, you can follow the API documentation here for reference.
Below, you will find a brief explanation on the API structure and how to call it.
x-apikey - This needs to be your apikey, you find your API key here. It is compulsory to provide an API key
For more details on API keys, refer here: https://nector.crisp.help/en/article/api-keys-docs
x-source - This can only be one of mobile, unix, web depending on the source of request call. It is compulsory to provide a source
x-workspaceid - This needs to be your workspaceid. You can find it in your dashboard, on the top right corner click on your Name dropdown menu. It is the first item in the menu. It is compuslory to provide a Workspace id.
trigger_id - It is the unique ID which exists for every Trigger, to find it go to Triggers and search for the trigger you want to use and click on the particular trigger, you will find the trigger_id at the bottom. It is compulsory to provide a trigger_id
lead_id - It is the unique ID generated by Nector for a particular user.
customer_id - It is the unique ID of the customer on your platform. It is used to map the customer on your platform the the customer on Nector. To find it go to Customers and search for the customer, and click on the particular customer, scroll below to the Edit Details section to find the customer_id
It is compulsory to provide a lead_id or a customer_id for the trigger to work.
If the customer with the given customer id doesn't exist on Nector, a new entry is created. You can pass the below details if a new customer is to be created on Nector.
referral_code - It is the referral code of this customer. If it is not passed, a random value is generated.
name - The name of the current customer
Under metadetail, you need to fill the following fields
email - This needs to be a valid email for the new customer
mobile - This needs to be a valid mobile number of the new customer
country - This needs to be one of the allowed countries for the new customer
gender - This can only be one of male, female, other for a new customer
dob - This needs to be ISO format date only for the new customer
If you want to override the rules set in the trigger at the time of making the API call, you need to first enable this option Allow override in the trigger settings.
Enabling override is helpful when you want to give different coins or different offers for each customer.
If it's a wallet trigger you want to override, under trace subschema fill up the fields under via_api_for_wallet
title - Any string that needs to be passed as a title.
description - Any string that needs to be passed as a description
operation - This can only be one of cr, dr
coin_range - This is the range between which the wallet point will be rewarded
If it's an offer trigger you want to override, under trace subschema fill up the fields under via_api_for_offer
offer_id - This needs to be offer_id value
A trigger holds the logic and conditions for rewarding. Read this article to learn more about triggers: https://nector.crisp.help/en/article/what-are-triggers
Before you can start using the APIs, create a trigger.
To reward wallet coins to your customers, you need to create a wallet based trigger, to learn how to create one, read here: https://nector.crisp.help/en/article/how-to-create-a-wallet-trigger
To reward a discount directly, you must create a offer based trigger, to learn how to create one, read here: https://nector.crisp.help/en/article/how-to-create-a-offer-trigger
This article is for explaining how to use Triggers for rewarding through APIs.
If the trigger is to be used in the frontend directly, make sure to mark it as Open so that it can called from a Read Only API Key
Once you have created the Trigger, you can follow the API documentation here for reference.
Below, you will find a brief explanation on the API structure and how to call it.
Request Method
Headers
x-apikey - This needs to be your apikey, you find your API key here. It is compulsory to provide an API key
For more details on API keys, refer here: https://nector.crisp.help/en/article/api-keys-docs
x-source - This can only be one of mobile, unix, web depending on the source of request call. It is compulsory to provide a source
x-workspaceid - This needs to be your workspaceid. You can find it in your dashboard, on the top right corner click on your Name dropdown menu. It is the first item in the menu. It is compuslory to provide a Workspace id.
Body
trigger_id - It is the unique ID which exists for every Trigger, to find it go to Triggers and search for the trigger you want to use and click on the particular trigger, you will find the trigger_id at the bottom. It is compulsory to provide a trigger_id
lead_id - It is the unique ID generated by Nector for a particular user.
customer_id - It is the unique ID of the customer on your platform. It is used to map the customer on your platform the the customer on Nector. To find it go to Customers and search for the customer, and click on the particular customer, scroll below to the Edit Details section to find the customer_id
It is compulsory to provide a lead_id or a customer_id for the trigger to work.
If the customer with the given customer id doesn't exist on Nector, a new entry is created. You can pass the below details if a new customer is to be created on Nector.
referral_code - It is the referral code of this customer. If it is not passed, a random value is generated.
name - The name of the current customer
Under metadetail, you need to fill the following fields
email - This needs to be a valid email for the new customer
mobile - This needs to be a valid mobile number of the new customer
country - This needs to be one of the allowed countries for the new customer
gender - This can only be one of male, female, other for a new customer
dob - This needs to be ISO format date only for the new customer
If you want to override the rules set in the trigger at the time of making the API call, you need to first enable this option Allow override in the trigger settings.
Enabling override is helpful when you want to give different coins or different offers for each customer.
If it's a wallet trigger you want to override, under trace subschema fill up the fields under via_api_for_wallet
title - Any string that needs to be passed as a title.
description - Any string that needs to be passed as a description
operation - This can only be one of cr, dr
coin_range - This is the range between which the wallet point will be rewarded
If it's an offer trigger you want to override, under trace subschema fill up the fields under via_api_for_offer
offer_id - This needs to be offer_id value
Updated on: 21/03/2024