Skip to content

Instantly share code, notes, and snippets.

@ryana
Created December 2, 2015 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryana/03d3e19b0cf36ab5547c to your computer and use it in GitHub Desktop.
Save ryana/03d3e19b0cf36ab5547c to your computer and use it in GitHub Desktop.
ChartURL / Knowtify.io Integration Example Part 2
# Part 1 at https://gist.github.com/ryana/7e64954d8dd15c858f30
def push_data_to_knowtify
api_token = "SEKRIT"
headers = {'Authorization' => "Token token=#{api_token}", 'Content-Type' => "application/json"}
url_base = "http://www.knowtify.io/api/v1"
endpoint = "/contacts/upsert"
data = {
contacts: [
{
name: "John",
email: "john@test.com",
data: {
category:"sports",
followers:300,
recent_activity_chart_url: charturl_url,
last_updated_at: Time.now.to_i
}
}
]
}
Typhoeus::Request.post("#{url_base}#{endpoint}", body: data.to_json, headers: headers)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment