This article will cover the following:
- What is a response token?
- Best practices for working with dynamic info being passed back from your buyer
What is a response token?
Response tokens are used to parse information from a buyer's response to a lead post. Response Tokens utilize regex to extract price, redirect destination, or buyer ID data from the response CAKE receives from a buyer.
- When trying to match a buyers parameter value, you will identify the parameter in your buyer's response that includes the value you are looking for and replace it with "(.+?)" which is considered the lazy match.
- When adding response tokens to CAKE, it is best to copy the buyers response directly from their posting doc to avoid error.
The following example is actually from CAKE's post response.
Example CAKE response:
Examples response token:
Since responses can vary, the lazy match may not work, but we have included a few examples Here is an example where the lazy match alone will not match - please see below.
Example Buyers Response:
Example Response Token:
The example above is escaping invalid reg ex characters. The "[" and "]" are invalid, so to escape them "\" precedes the invalid reg ex characters.
Any time CAKE sees a price response token, the buyer contract is considered to have a dynamic price meaning that the price is unknown until it is received from the buyer's response and any set price will be overridden.
Example price response token: Price>(.+?)</Price
A redirect URL is best described as the end location that your buyer wants the user redirected to upon purchasing the lead.
Example redirect URL response token: URL>(.+?)</URL
The lead ID token is the only response token that will be used if a lead is NOT sold to a buyer contract as it is the buyer's lead id. It can be viewed in the master buyer report so if you ever get feedback from a buyer you can use this ID to be on the same page as your buyer.
Example lead ID response token: Lead_ID>(.+?)</Lead_ID
When CAKE responds back with the values that were captured in the response tokens it is considered 'literal', meaning your buyer has an XML encoded version that CAKE is going to redirect to. Since an XML encoded redirect URL will not be interpreted by the browser successfully, this setting to XML decode the response should be used in applicable situations to ensure that the redirect URL will redirect successfully.