This guide outlines how to configure BHN reward point allocation for ARG using the Rival platform. It includes steps for setting up credentials, webhooks, secret keys, whitelisted domains, and scripting to allocate points to participants.
Step 1: Generate BHN secret keys
Log into BHN
From the top navigation bar, go to Settings β API
Click Edit under API access keys
Click Generate new client
Enter a Client Name and click NEXT
BHN will generate a:
Client ID
Client Secret
π Save both values, as they will be added to Rival as secrets.
Step 2: Generate auth secret
bhn_authsecret is base64 encoded string generated using client id and client secretPaste {{client_id}}:{{client_secret}}
Step 3: Save Secret keys in Rival
Where to Navigate
Go to the Settings tab from the top header (this space is only accessible to Research Domain Admins).
In the left-hand navigation, go to Platforms.
Click on the Secret Key Pairs tab.
Click the β Action button to add new secret key pairs.
Secrets to Add
Secret Label | Description |
| BHN client ID |
| BHN client secret |
| Base64 encode string generated in step 2 |
Step 4: Add whitelisted domain in Rival
Where to Navigate
Go to the Settings tab from the top header (Research Domain Admin access only).
In the left-hand navigation, go to Platforms.
Click on the Whitelisted Domains tab.
Click the β Action button to add a new whitelisted domain.
URLs to Whitelist
Step 5: Use Rival chat script to allocate points
sample script to allocate points
-- Assign points to be allocated
local ptsAdd = 50
-- End if RewardPoints is not at least 1
if ptsAdd < 1 then
return 0
end
-- Generate Authorization Token
local authEndpoint = 'https://oauth.rybbon.net/oauth2/token'
local authPayload = {}
local authOptions = {}
authOptions['Authorization'] = 'Basic {{{secrets.bhn_auth}}}'
authOptions['Content-Type'] = 'application/x-www-form-urlencoded'
authPayload['grant_type'] = 'client_credentials'
authPayload['client_id'] = '{{{secrets.bhn_client_id}}}'
local authResult = postHttp(authEndpoint, authPayload, authOptions)
local authStatus = authResult.statusCode
-- End if Authentication call is not successful
if authStatus ~= 200 then
log('BHN Authentication failed.')
return -1
end
local authToken = authResult.data.access_token
-- Retrieve Participant Data + Chat Data (hard codes country to USA)
local respondent = getParticipant()
local respondentEmail = getProfileAttribute("EmailAddress").Value
local respondentName = getProfileAttribute("NAME").Value
local respondentCountry = "USA"
local respondentId = respondent.participantId
local chatName = getChatProperty('name')
-- End if Email or Name does not exist
if respondentEmail == null or respondentName == null then
log('No respondent email or name - points assignment will be skipped.')
return 0
end
-- Add points
local ptsEndpoint = 'https://api.rybbon.net/v2/points'
local ptsPayload = {}
local ptsOptions = {}
ptsOptions['Authorization'] = 'Bearer '..authToken
ptsPayload['email'] = respondentEmail
ptsPayload['points'] = ptsAdd
ptsPayload['firstName'] = respondentName
ptsPayload['country'] = respondentCountry
ptsPayload['referenceId'] = respondentId
ptsPayload['comment'] = 'Points rewarded from '..chatName
local ptsResult = postHttp(ptsEndpoint, ptsPayload, ptsOptions)
local ptsStatus = ptsResult.statusCode
-- End if Points BHN call is not successful
if authStatus ~= 200 then
log('BHN Points Reward failed.')
return 0
end
local ptsAdded = convertToNumber(ptsAdd)
return ptsAdded
β

