Skip to main content

Loading existing customer data

As a tool for making targeted campaigns, Talon.One can only be as powerful as the data you give it. When first setting up your integration, ensure you prefill information about your customers so that your campaigns can make smart decisions immediately.

Loading customer profiles#

The Talon.One representation of your customer is called a customer profile, and you update profile data with the updateCustomerProfile endpoint .

Below is an example of creating a profile for every existing customer in a Ruby application:

talon =
User.each do |user|  talon.update_customer_profile "user-#{}", {    :attributes => {      "Name" =>,      "Email" =>,      "SignupDate" => user.created_at,      "Phone" => user.phone_number,    }  }end

Some points of note about the above code sample:

  • The exact details of how to map your customer data to profile attributes depends on your application.
  • A complete list of built-in attributes can be found in the attribute library reference.
  • You can also define your own profile attributes for any other data you might wish to use when targeting campaigns.

Loading past customer sessions#

If you look at the responses to the updateCustomerProfile operation, you will see a number of hard-coded properties on profiles for data managed by the Talon.One API, such as TotalSales. Your existing customers might have some sales history, and you might want to use this history when targeting campaigns, so this information should also be added to Talon.One using the updateCustomerSession operation. Similar to profiles, you can loop through these past orders and create a session for each one:

Order.where(:state => "closed").each do |order|  talon.update_customer_session "order-#{}", {    "profileId" => "user-#{}",    "total" =>,    "state" => "closed",    "attributes" => {      "BillingName" =>,      "ShippingCost" => order.shipping_cost,    }  }

Notes about the above sample code:

  • Like customer profiles, the exact details of mapping order history to session attributes will depend on your application.
  • You can see the standard library attributes on this reference page, and/or create any custom attributes you wish to use in your campaigns.
  • The profileId of a session should match the ID you created when loading customer profiles.
  • The state of a session must be set to closed for Talon.One to include that order in the total sales calculation for the associated profile.