# ADAPTIVE DISCOUNTING
# First register your data to produce event streams
curl https://api.faraday.ai/datasets --header 'Authorization: Bearer $YOUR_API_TOKEN' --json '{
"name": "Signup",
"identity_sets": {
"shipping": {...}
},
"options": {
"type": "hosted_csv",
"upload_directory": "signup_data_files"
},
"output_to_streams": {
"signup": {
"data_map": {
"datetime": "created_at"
},
"value": "total"
}
}
}'
# Now organize your customer data into cohorts
curl https://api.faraday.ai/cohorts --header 'Authorization: Bearer $YOUR_API_TOKEN' --json '{
"name": "Leads",
"stream_name": "signup"
}'
# Next, declare your prediction objectives
# ⚠️ Uses prerelease features which may not work for your account: Forecast
curl https://api.faraday.ai/forecasts --header 'Authorization: Bearer $YOUR_API_TOKEN' --json '{
"name": "Forecasted spend",
"stream_name": "transaction",
"stream_property_name": "value"
}'
# And finally complete your pipeline to deploy
curl https://api.faraday.ai/scopes --header 'Authorization: Bearer $YOUR_API_TOKEN' --json '{
"name": "Adaptive discounting",
"population": {
"include": [
"$LEADS_COHORT_ID"
]
},
"payload": {
"forecast_ids": [
"$FORECASTED_SPEND_FORECAST_ID"
]
}
}';