Transaction
The transaction event stream represents the occurrence of transactions in your data, enabling various customer-focused predictions.
In this tutorial, we'll show you how to:
- Add data representing your transaction events using a dataset.
Let's dive in.
- You'll need a Faraday account — signup is free!
Add data
Create a transaction event stream
Using CSV as an easy example
This section describes how to add data securely using a CSV file that you export from your data infrastructure.
Most Faraday users eventually update their configuration to pull data directly from their data warehouses, cloud buckets, or databases. To do that, you’ll add your source as a Connection and then choose it below instead of CSV.
For more, see our docs on Datasets and Connections.
- Extract a CSV representing your transaction from your systems, or download the sample transactions file from Farazona. Either way, save it someplace memorable.
First, upload your data with a POST /uploads
request:
curl --request POST \ --url https://api.faraday.ai/v1/uploads/transactions/YOUR_CSV_FILE.csv \ --header 'Accept: application/json' \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'Content-Type: application/octet-stream' \ --data-binary "@YOUR_CSV_FILE.csv"
Then use a POST /datasets
request to register the data:
curl https://api.faraday.ai/datasets --json '{ "name": "Transaction", "identity_sets": { "shipping": { "city": "shipping_city", "house_number_and_street": [ "shipping_address1", "shipping_address2" ], "person_first_name": "shipping_address_fn", "person_last_name": "shipping_address_ln", "postcode": "shipping_postcode", "state": "shipping_state" } }, "options": { "type": "hosted_csv", "upload_directory": "transaction_data_files" }, "output_to_streams": { "transaction": { "data_map": { "datetime": "created_at" }, "value": "total" } } }'
Your event stream will start building in the background. You can proceed immediately with the next set of instructions. When your stream is done building, you’ll get an email.