11th May 2021

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 you will want to 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 by performing the updateCustomerProfile API operation. Below is an example of creating a profile for every existing customer in a Ruby application:

talon = TalonOne::Integration::Client.new

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

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-#{order.id}", {
    "profileId" => "user-#{order.user.id}",
    "total" => order.total,
    "state" => "closed",
    "attributes" => {
      "BillingName" => order.billing_details.name,
      "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.
Still need help? Get in touch!
Last updated on 11th May 2021

Was this article helpful?

Thank you! You have already voted

If you’d like a member of our support team to respond to you, please send a note to support@talon.one