Decipher API Integration guide
STEP 1
Add the below 2 urls in the api.txt file, located in the company directory (selfserve/XXX)
(requires shell access, the Forsta support team can do it, too):
better-params-api.rose.conceptsauce.io
public-survey-data-api.rose.conceptsauce.io
Knowledge base link - https://decipher.zendesk.com/hc/en-us/articles/360010277973-Generic-API-Call
STEP 2
Add the below 2 to your sample source:
<var name="param_id" required="1"/>
<var name="respondent_id" unique="1"/>
In order to successfully do the API call - we're parsing some symbols away from the JSON object so the system accepts it, the symbols '
and *
If any of these symbols is used in either the param_id
or respondent_id
variables - it will not return the correct result from the API call.
For example - instead of using respondent_id
test123*/test123'
it should just be test123
STEP 3
Add the below code to your survey:
Add the below code to your survey:
<exec cond="not gv.isSST()">
surveyDir = "https://XXXX.XXXX.com/survey/%(first)s?state=[state]" % {"first": gv.survey.path}
redirectTarget = "https://survey.rose.conceptsauce.io/?param_id=%(first)s&respondent_id=%(second)s&link=%(third)s" % {"first": param_id, "second": respondent_id, "third": surveyDir}
The survey url, the XXXX parts should be replaced with yours (could be seen by opening the survey)
STEP 3 + base64 options
Base64 options. Add the below code to your survey:
disableProds = {
"shelf": {
"set:disabled_products": [
"Product SKU CODE",
"Product SKU CODE"
]
}
}
findDisabledProds = "&custom_params=" + str(disableProds).replace("'",'"').replace(" ","").encode("base64").replace("\n","").replace("\t","")
surveyDir = "https://XXXX.XXXX.com/survey/%(first)s?state=[state]" % {"first": gv.survey.path}
redirectTarget = "https://survey.rose.conceptsauce.io/?param_id=%(first)s&respondent_id=%(second)s&link=%(third)s%(disableProds)s" % {"first": param_id, "second": respondent_id, "third": surveyDir, "disableProds": findDisabledProds}
The survey url, the XXXX parts should be replaced with yours (could be seen by opening the survey)
Make sure you change Product SKU CODE
to the product code that is used in the shelf. Add as many as you need.
STEP 4
Redirecting:
STEP 5
JSON object needed for first API request:
Please do not forget to add another step to retrieve the respondent_encoded
, this is a new method for the API that has been added. More info on this here:Basic API calls
STEP 6
The first API request, using Decipher’s build in logic node:
STEP 7
If API call successful - create the needed JSON object for the second API request:
STEP 8
Second API request:
STEP 9
Saving the total_unique_sku
value:
STEP 10
Saving the total_value
of basket:
STEP 11 - Final step 🥳
Saving each selected product:
And here is all the code in one script:
Also attached is a JPG to explain all the code in one place:
©2020 ConceptSauce ltd / For further help please contact us directly on Team@conceptsauce.io