Created
December 2, 2015 23:53
-
-
Save ryana/03d3e19b0cf36ab5547c to your computer and use it in GitHub Desktop.
ChartURL / Knowtify.io Integration Example Part 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: "[email protected]", | |
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