{"action":"created","comment":{"url":"https://api.github.com/repos/jipiboily/forwardlytics/pulls/comments/81719983","pull_request_review_id":2678369,"id":81719983,"diff_hunk":"@@ -0,0 +1,136 @@\n+package drift\n+\n+import (\n+\t\"bytes\"\n+\t\"encoding/json\"\n+\t\"io/ioutil\"\n+\t\"net/http\"\n+\t\"os\"\n+\n+\t\"github.com/Sirupsen/logrus\"\n+\t\"github.com/jipiboily/forwardlytics/integrations\"\n+)\n+\n+// Drift integration\n+type Drift struct {\n+\tapi service\n+}\n+\n+type service interface {\n+\trequest(string, string, []byte) error\n+}\n+\n+type driftAPIProduction struct {\n+\tbaseUrl string\n+}\n+\n+type apiSubscriber struct {\n+\tAttributes map[string]interface{} `json:\"attributes\"`\n+\tCreatedAt  int64                  `json:\"createdAt\"`\n+\tUserId     string                 `json:\"userId\"`\n+\tOrgId      string                 `json:\"orgId\"`\n+}\n+\n+type apiEvent struct {\n+\tOrgId      string                 `json:\"orgId\"`\n+\tUserId     string                 `json:\"userId\"`\n+\tEvent      string                 `json:\"event\"`\n+\tCreatedAt  int64                  `json:\"createdAt\"`\n+\tAttributes map[string]interface{} `json:\"attributes\"`\n+}\n+\n+// Identify forwards and identify call to Drift\n+func (d Drift) Identify(identification integrations.Identification) (err error) {\n+\ts := apiSubscriber{}\n+\ts.UserId = string(identification.UserID)\n+\ts.CreatedAt = identification.Timestamp\n+\ts.OrgId = orgID()\n+\t// Add custom attributes\n+\ts.Attributes = identification.UserTraits\n+\ts.Attributes[\"forwardlyticsReceivedAt\"] = identification.ReceivedAt\n+\ts.Attributes[\"forwardlyticsTimestamp\"] = identification.Timestamp\n+\tpayload, err := json.Marshal(s)\n+\n+\terr = d.api.request(\"POST\", \"identify\", payload)\n+\tif err != nil {\n+\t\tlogrus.WithError(err).WithField(\"identify\", identification).WithField(\"payload\", payload)","path":"integrations/drift/drift.go","position":56,"original_position":56,"commit_id":"b2b9b72792665f083b5432dfbed7705328d8e1c0","original_commit_id":"b2b9b72792665f083b5432dfbed7705328d8e1c0","user":{"login":"jipiboily","id":232993,"avatar_url":"https://avatars.githubusercontent.com/u/232993?v=3","gravatar_id":"","url":"https://api.github.com/users/jipiboily","html_url":"https://github.com/jipiboily","followers_url":"https://api.github.com/users/jipiboily/followers","following_url":"https://api.github.com/users/jipiboily/following{/other_user}","gists_url":"https://api.github.com/users/jipiboily/gists{/gist_id}","starred_url":"https://api.github.com/users/jipiboily/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jipiboily/subscriptions","organizations_url":"https://api.github.com/users/jipiboily/orgs","repos_url":"https://api.github.com/users/jipiboily/repos","events_url":"https://api.github.com/users/jipiboily/events{/privacy}","received_events_url":"https://api.github.com/users/jipiboily/received_events","type":"User","site_admin":false},"body":"You forgot the `.Error` part 😬 ","created_at":"2016-10-04T09:39:39Z","updated_at":"2016-10-04T09:40:25Z","html_url":"https://github.com/jipiboily/forwardlytics/pull/41#discussion_r81719983","pull_request_url":"https://api.github.com/repos/jipiboily/forwardlytics/pulls/41","_links":{"self":{"href":"https://api.github.com/repos/jipiboily/forwardlytics/pulls/comments/81719983"},"html":{"href":"https://github.com/jipiboily/forwardlytics/pull/41#discussion_r81719983"},"pull_request":{"href":"https://api.github.com/repos/jipiboily/forwardlytics/pulls/41"}}},"pull_request":{"url":"https://api.github.com/repos/jipiboily/forwardlytics/pulls/41","id":87210550,"html_url":"https://github.com/jipiboily/forwardlytics/pull/41","diff_url":"https://github.com/jipiboily/forwardlytics/pull/41.diff","patch_url":"https://github.com/jipiboily/forwardlytics/pull/41.patch","issue_url":"https://api.github.com/repos/jipiboily/forwardlytics/issues/41","number":41,"state":"open","locked":false,"title":"Added drift integration","user":{"login":"helgeblod","id":2901515,"avatar_url":"https://avatars.githubusercontent.com/u/2901515?v=3","gravatar_id":"","url":"https://api.github.com/users/helgeblod","html_url":"https://github.com/helgeblod","followers_url":"https://api.github.com/users/helgeblod/followers","following_url":"https://api.github.com/users/helgeblod/following{/other_user}","gists_url":"https://api.github.com/users/helgeblod/gists{/gist_id}","starred_url":"https://api.github.com/users/helgeblod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helgeblod/subscriptions","organizations_url":"https://api.github.com/users/helgeblod/orgs","repos_url":"https://api.github.com/users/helgeblod/repos","events_url":"https://api.github.com/users/helgeblod/events{/privacy}","received_events_url":"https://api.github.com/users/helgeblod/received_events","type":"User","site_admin":false},"body":"Feedback appreciated :)","created_at":"2016-09-28T22:04:07Z","updated_at":"2016-10-04T09:40:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00d57528161278a097f94ff47c40ad5008f08f96","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/jipiboily/forwardlytics/pulls/41/commits","review_comments_url":"https://api.github.com/repos/jipiboily/forwardlytics/pulls/41/comments","review_comment_url":"https://api.github.com/repos/jipiboily/forwardlytics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jipiboily/forwardlytics/issues/41/comments","statuses_url":"https://api.github.com/repos/jipiboily/forwardlytics/statuses/b2b9b72792665f083b5432dfbed7705328d8e1c0","head":{"label":"helgeblod:master","ref":"master","sha":"b2b9b72792665f083b5432dfbed7705328d8e1c0","user":{"login":"helgeblod","id":2901515,"avatar_url":"https://avatars.githubusercontent.com/u/2901515?v=3","gravatar_id":"","url":"https://api.github.com/users/helgeblod","html_url":"https://github.com/helgeblod","followers_url":"https://api.github.com/users/helgeblod/followers","following_url":"https://api.github.com/users/helgeblod/following{/other_user}","gists_url":"https://api.github.com/users/helgeblod/gists{/gist_id}","starred_url":"https://api.github.com/users/helgeblod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helgeblod/subscriptions","organizations_url":"https://api.github.com/users/helgeblod/orgs","repos_url":"https://api.github.com/users/helgeblod/repos","events_url":"https://api.github.com/users/helgeblod/events{/privacy}","received_events_url":"https://api.github.com/users/helgeblod/received_events","type":"User","site_admin":false},"repo":{"id":66058229,"name":"forwardlytics","full_name":"helgeblod/forwardlytics","owner":{"login":"helgeblod","id":2901515,"avatar_url":"https://avatars.githubusercontent.com/u/2901515?v=3","gravatar_id":"","url":"https://api.github.com/users/helgeblod","html_url":"https://github.com/helgeblod","followers_url":"https://api.github.com/users/helgeblod/followers","following_url":"https://api.github.com/users/helgeblod/following{/other_user}","gists_url":"https://api.github.com/users/helgeblod/gists{/gist_id}","starred_url":"https://api.github.com/users/helgeblod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helgeblod/subscriptions","organizations_url":"https://api.github.com/users/helgeblod/orgs","repos_url":"https://api.github.com/users/helgeblod/repos","events_url":"https://api.github.com/users/helgeblod/events{/privacy}","received_events_url":"https://api.github.com/users/helgeblod/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/helgeblod/forwardlytics","description":"Take events and customer data in and send them to various providers, mostly analytics providers.","fork":true,"url":"https://api.github.com/repos/helgeblod/forwardlytics","forks_url":"https://api.github.com/repos/helgeblod/forwardlytics/forks","keys_url":"https://api.github.com/repos/helgeblod/forwardlytics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/helgeblod/forwardlytics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/helgeblod/forwardlytics/teams","hooks_url":"https://api.github.com/repos/helgeblod/forwardlytics/hooks","issue_events_url":"https://api.github.com/repos/helgeblod/forwardlytics/issues/events{/number}","events_url":"https://api.github.com/repos/helgeblod/forwardlytics/events","assignees_url":"https://api.github.com/repos/helgeblod/forwardlytics/assignees{/user}","branches_url":"https://api.github.com/repos/helgeblod/forwardlytics/branches{/branch}","tags_url":"https://api.github.com/repos/helgeblod/forwardlytics/tags","blobs_url":"https://api.github.com/repos/helgeblod/forwardlytics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/helgeblod/forwardlytics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/helgeblod/forwardlytics/git/refs{/sha}","trees_url":"https://api.github.com/repos/helgeblod/forwardlytics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/helgeblod/forwardlytics/statuses/{sha}","languages_url":"https://api.github.com/repos/helgeblod/forwardlytics/languages","stargazers_url":"https://api.github.com/repos/helgeblod/forwardlytics/stargazers","contributors_url":"https://api.github.com/repos/helgeblod/forwardlytics/contributors","subscribers_url":"https://api.github.com/repos/helgeblod/forwardlytics/subscribers","subscription_url":"https://api.github.com/repos/helgeblod/forwardlytics/subscription","commits_url":"https://api.github.com/repos/helgeblod/forwardlytics/commits{/sha}","git_commits_url":"https://api.github.com/repos/helgeblod/forwardlytics/git/commits{/sha}","comments_url":"https://api.github.com/repos/helgeblod/forwardlytics/comments{/number}","issue_comment_url":"https://api.github.com/repos/helgeblod/forwardlytics/issues/comments{/number}","contents_url":"https://api.github.com/repos/helgeblod/forwardlytics/contents/{+path}","compare_url":"https://api.github.com/repos/helgeblod/forwardlytics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/helgeblod/forwardlytics/merges","archive_url":"https://api.github.com/repos/helgeblod/forwardlytics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/helgeblod/forwardlytics/downloads","issues_url":"https://api.github.com/repos/helgeblod/forwardlytics/issues{/number}","pulls_url":"https://api.github.com/repos/helgeblod/forwardlytics/pulls{/number}","milestones_url":"https://api.github.com/repos/helgeblod/forwardlytics/milestones{/number}","notifications_url":"https://api.github.com/repos/helgeblod/forwardlytics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/helgeblod/forwardlytics/labels{/name}","releases_url":"https://api.github.com/repos/helgeblod/forwardlytics/releases{/id}","deployments_url":"https://api.github.com/repos/helgeblod/forwardlytics/deployments","created_at":"2016-08-19T06:24:37Z","updated_at":"2016-08-19T06:24:38Z","pushed_at":"2016-10-04T07:20:20Z","git_url":"git://github.com/helgeblod/forwardlytics.git","ssh_url":"git@github.com:helgeblod/forwardlytics.git","clone_url":"https://github.com/helgeblod/forwardlytics.git","svn_url":"https://github.com/helgeblod/forwardlytics","homepage":"http://jipiboily.com/","size":658,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jipiboily:master","ref":"master","sha":"798c7c19749f140f2a6308bc1f929c40dfcefbb7","user":{"login":"jipiboily","id":232993,"avatar_url":"https://avatars.githubusercontent.com/u/232993?v=3","gravatar_id":"","url":"https://api.github.com/users/jipiboily","html_url":"https://github.com/jipiboily","followers_url":"https://api.github.com/users/jipiboily/followers","following_url":"https://api.github.com/users/jipiboily/following{/other_user}","gists_url":"https://api.github.com/users/jipiboily/gists{/gist_id}","starred_url":"https://api.github.com/users/jipiboily/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jipiboily/subscriptions","organizations_url":"https://api.github.com/users/jipiboily/orgs","repos_url":"https://api.github.com/users/jipiboily/repos","events_url":"https://api.github.com/users/jipiboily/events{/privacy}","received_events_url":"https://api.github.com/users/jipiboily/received_events","type":"User","site_admin":false},"repo":{"id":55230917,"name":"forwardlytics","full_name":"jipiboily/forwardlytics","owner":{"login":"jipiboily","id":232993,"avatar_url":"https://avatars.githubusercontent.com/u/232993?v=3","gravatar_id":"","url":"https://api.github.com/users/jipiboily","html_url":"https://github.com/jipiboily","followers_url":"https://api.github.com/users/jipiboily/followers","following_url":"https://api.github.com/users/jipiboily/following{/other_user}","gists_url":"https://api.github.com/users/jipiboily/gists{/gist_id}","starred_url":"https://api.github.com/users/jipiboily/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jipiboily/subscriptions","organizations_url":"https://api.github.com/users/jipiboily/orgs","repos_url":"https://api.github.com/users/jipiboily/repos","events_url":"https://api.github.com/users/jipiboily/events{/privacy}","received_events_url":"https://api.github.com/users/jipiboily/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jipiboily/forwardlytics","description":"Take events and customer data in and send them to various providers, mostly analytics providers.","fork":false,"url":"https://api.github.com/repos/jipiboily/forwardlytics","forks_url":"https://api.github.com/repos/jipiboily/forwardlytics/forks","keys_url":"https://api.github.com/repos/jipiboily/forwardlytics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jipiboily/forwardlytics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jipiboily/forwardlytics/teams","hooks_url":"https://api.github.com/repos/jipiboily/forwardlytics/hooks","issue_events_url":"https://api.github.com/repos/jipiboily/forwardlytics/issues/events{/number}","events_url":"https://api.github.com/repos/jipiboily/forwardlytics/events","assignees_url":"https://api.github.com/repos/jipiboily/forwardlytics/assignees{/user}","branches_url":"https://api.github.com/repos/jipiboily/forwardlytics/branches{/branch}","tags_url":"https://api.github.com/repos/jipiboily/forwardlytics/tags","blobs_url":"https://api.github.com/repos/jipiboily/forwardlytics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jipiboily/forwardlytics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jipiboily/forwardlytics/git/refs{/sha}","trees_url":"https://api.github.com/repos/jipiboily/forwardlytics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jipiboily/forwardlytics/statuses/{sha}","languages_url":"https://api.github.com/repos/jipiboily/forwardlytics/languages","stargazers_url":"https://api.github.com/repos/jipiboily/forwardlytics/stargazers","contributors_url":"https://api.github.com/repos/jipiboily/forwardlytics/contributors","subscribers_url":"https://api.github.com/repos/jipiboily/forwardlytics/subscribers","subscription_url":"https://api.github.com/repos/jipiboily/forwardlytics/subscription","commits_url":"https://api.github.com/repos/jipiboily/forwardlytics/commits{/sha}","git_commits_url":"https://api.github.com/repos/jipiboily/forwardlytics/git/commits{/sha}","comments_url":"https://api.github.com/repos/jipiboily/forwardlytics/comments{/number}","issue_comment_url":"https://api.github.com/repos/jipiboily/forwardlytics/issues/comments{/number}","contents_url":"https://api.github.com/repos/jipiboily/forwardlytics/contents/{+path}","compare_url":"https://api.github.com/repos/jipiboily/forwardlytics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jipiboily/forwardlytics/merges","archive_url":"https://api.github.com/repos/jipiboily/forwardlytics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jipiboily/forwardlytics/downloads","issues_url":"https://api.github.com/repos/jipiboily/forwardlytics/issues{/number}","pulls_url":"https://api.github.com/repos/jipiboily/forwardlytics/pulls{/number}","milestones_url":"https://api.github.com/repos/jipiboily/forwardlytics/milestones{/number}","notifications_url":"https://api.github.com/repos/jipiboily/forwardlytics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jipiboily/forwardlytics/labels{/name}","releases_url":"https://api.github.com/repos/jipiboily/forwardlytics/releases{/id}","deployments_url":"https://api.github.com/repos/jipiboily/forwardlytics/deployments","created_at":"2016-04-01T12:28:34Z","updated_at":"2016-09-28T17:24:08Z","pushed_at":"2016-10-04T07:20:20Z","git_url":"git://github.com/jipiboily/forwardlytics.git","ssh_url":"git@github.com:jipiboily/forwardlytics.git","clone_url":"https://github.com/jipiboily/forwardlytics.git","svn_url":"https://github.com/jipiboily/forwardlytics","homepage":"http://jipiboily.com/","size":659,"stargazers_count":18,"watchers_count":18,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":11,"forks":4,"open_issues":11,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jipiboily/forwardlytics/pulls/41"},"html":{"href":"https://github.com/jipiboily/forwardlytics/pull/41"},"issue":{"href":"https://api.github.com/repos/jipiboily/forwardlytics/issues/41"},"comments":{"href":"https://api.github.com/repos/jipiboily/forwardlytics/issues/41/comments"},"review_comments":{"href":"https://api.github.com/repos/jipiboily/forwardlytics/pulls/41/comments"},"review_comment":{"href":"https://api.github.com/repos/jipiboily/forwardlytics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jipiboily/forwardlytics/pulls/41/commits"},"statuses":{"href":"https://api.github.com/repos/jipiboily/forwardlytics/statuses/b2b9b72792665f083b5432dfbed7705328d8e1c0"}}}}
{"actor":{"display_login":"jipiboily"}}