{"action":"created","comment":{"url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls/comments/70251878","id":70251878,"diff_hunk":"@@ -21,4 +22,27 @@ def validate_voucher():\n         response['validity'] = 'valid'\n     except VoucherException as e:\n         response['reason'] = str(e)\n-    return json.dumps(response)\n+    return create_response(response)\n+\n+\n+@api.route('/ft/save', methods=['POST'])\n+@limit(max_requests=10000, group=\"voucher\", by='ip')\n+def save_run():\n+    action = 'insert'\n+    data = request.json or request.form\n+    phone = data.get('phone')\n+    flow_id = data.get('flow')\n+    email = request.args.get('email')\n+    values = json.loads(data.get('values'))\n+\n+    flow = Flow.get_by_flow(flow_id)\n+    if flow:\n+        flow.update_email(email)\n+    else:\n+        action = 'create and insert'\n+        flow = Flow.create_from_run(data, email)\n+\n+    flow.update_fusion_table(phone, values)\n+\n+    response = {'action': action, 'ft_id': flow.ft_id, 'success': True}","path":"api/v1/vouchers/views.py","position":39,"original_position":39,"commit_id":"180553183f8b7208f3cccf89a938d8723ed3e2ee","original_commit_id":"180553183f8b7208f3cccf89a938d8723ed3e2ee","user":{"login":"ewheeler","id":15692,"avatar_url":"https://avatars.githubusercontent.com/u/15692?v=3","gravatar_id":"","url":"https://api.github.com/users/ewheeler","html_url":"https://github.com/ewheeler","followers_url":"https://api.github.com/users/ewheeler/followers","following_url":"https://api.github.com/users/ewheeler/following{/other_user}","gists_url":"https://api.github.com/users/ewheeler/gists{/gist_id}","starred_url":"https://api.github.com/users/ewheeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewheeler/subscriptions","organizations_url":"https://api.github.com/users/ewheeler/orgs","repos_url":"https://api.github.com/users/ewheeler/repos","events_url":"https://api.github.com/users/ewheeler/events{/privacy}","received_events_url":"https://api.github.com/users/ewheeler/received_events","type":"User","site_admin":false},"body":"`success` is always `True`?!","created_at":"2016-07-11T12:58:51Z","updated_at":"2016-07-11T12:58:51Z","html_url":"https://github.com/ewheeler/rapidpro-webhooks/pull/4#discussion_r70251878","pull_request_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls/comments/70251878"},"html":{"href":"https://github.com/ewheeler/rapidpro-webhooks/pull/4#discussion_r70251878"},"pull_request":{"href":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls/4","id":76946786,"html_url":"https://github.com/ewheeler/rapidpro-webhooks/pull/4","diff_url":"https://github.com/ewheeler/rapidpro-webhooks/pull/4.diff","patch_url":"https://github.com/ewheeler/rapidpro-webhooks/pull/4.patch","issue_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/issues/4","number":4,"state":"closed","locked":false,"title":"Adding a webhook that exports flow runs to Google Fusion Tables","user":{"login":"xkmato","id":1177423,"avatar_url":"https://avatars.githubusercontent.com/u/1177423?v=3","gravatar_id":"","url":"https://api.github.com/users/xkmato","html_url":"https://github.com/xkmato","followers_url":"https://api.github.com/users/xkmato/followers","following_url":"https://api.github.com/users/xkmato/following{/other_user}","gists_url":"https://api.github.com/users/xkmato/gists{/gist_id}","starred_url":"https://api.github.com/users/xkmato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xkmato/subscriptions","organizations_url":"https://api.github.com/users/xkmato/orgs","repos_url":"https://api.github.com/users/xkmato/repos","events_url":"https://api.github.com/users/xkmato/events{/privacy}","received_events_url":"https://api.github.com/users/xkmato/received_events","type":"User","site_admin":false},"body":"# Usage\r\nAdd an `call external service` action at the end of your flow: `http://webhooks.uniceflabs.org/api/v1/ft/save?email=<gmail to access the fusiontable>`\r\n\r\nFusion Tables is a Google service, one needs a Google account to access them. Either Gmail or Google Apps account will work.\r\n\r\nIn case no email is provided, `rapidprodata@gmail.com` will be used.","created_at":"2016-07-11T12:41:51Z","updated_at":"2016-07-11T12:58:51Z","closed_at":"2016-07-11T12:55:56Z","merged_at":"2016-07-11T12:55:56Z","merge_commit_sha":"9ad50fdf2f312f928990591175b21227142faa84","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls/4/commits","review_comments_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls/4/comments","review_comment_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/issues/4/comments","statuses_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/statuses/180553183f8b7208f3cccf89a938d8723ed3e2ee","head":{"label":"xkmato:master","ref":"master","sha":"180553183f8b7208f3cccf89a938d8723ed3e2ee","user":{"login":"xkmato","id":1177423,"avatar_url":"https://avatars.githubusercontent.com/u/1177423?v=3","gravatar_id":"","url":"https://api.github.com/users/xkmato","html_url":"https://github.com/xkmato","followers_url":"https://api.github.com/users/xkmato/followers","following_url":"https://api.github.com/users/xkmato/following{/other_user}","gists_url":"https://api.github.com/users/xkmato/gists{/gist_id}","starred_url":"https://api.github.com/users/xkmato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xkmato/subscriptions","organizations_url":"https://api.github.com/users/xkmato/orgs","repos_url":"https://api.github.com/users/xkmato/repos","events_url":"https://api.github.com/users/xkmato/events{/privacy}","received_events_url":"https://api.github.com/users/xkmato/received_events","type":"User","site_admin":false},"repo":{"id":37057595,"name":"rapidpro-webhooks","full_name":"xkmato/rapidpro-webhooks","owner":{"login":"xkmato","id":1177423,"avatar_url":"https://avatars.githubusercontent.com/u/1177423?v=3","gravatar_id":"","url":"https://api.github.com/users/xkmato","html_url":"https://github.com/xkmato","followers_url":"https://api.github.com/users/xkmato/followers","following_url":"https://api.github.com/users/xkmato/following{/other_user}","gists_url":"https://api.github.com/users/xkmato/gists{/gist_id}","starred_url":"https://api.github.com/users/xkmato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xkmato/subscriptions","organizations_url":"https://api.github.com/users/xkmato/orgs","repos_url":"https://api.github.com/users/xkmato/repos","events_url":"https://api.github.com/users/xkmato/events{/privacy}","received_events_url":"https://api.github.com/users/xkmato/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/xkmato/rapidpro-webhooks","description":"","fork":true,"url":"https://api.github.com/repos/xkmato/rapidpro-webhooks","forks_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/forks","keys_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/teams","hooks_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/hooks","issue_events_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/issues/events{/number}","events_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/events","assignees_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/assignees{/user}","branches_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/branches{/branch}","tags_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/tags","blobs_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/git/refs{/sha}","trees_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/statuses/{sha}","languages_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/languages","stargazers_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/stargazers","contributors_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/contributors","subscribers_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/subscribers","subscription_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/subscription","commits_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/commits{/sha}","git_commits_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/git/commits{/sha}","comments_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/comments{/number}","issue_comment_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/issues/comments{/number}","contents_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/contents/{+path}","compare_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/merges","archive_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/downloads","issues_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/issues{/number}","pulls_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/pulls{/number}","milestones_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/milestones{/number}","notifications_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/labels{/name}","releases_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/releases{/id}","deployments_url":"https://api.github.com/repos/xkmato/rapidpro-webhooks/deployments","created_at":"2015-06-08T09:22:46Z","updated_at":"2016-07-11T12:35:55Z","pushed_at":"2016-07-11T12:35:53Z","git_url":"git://github.com/xkmato/rapidpro-webhooks.git","ssh_url":"git@github.com:xkmato/rapidpro-webhooks.git","clone_url":"https://github.com/xkmato/rapidpro-webhooks.git","svn_url":"https://github.com/xkmato/rapidpro-webhooks","homepage":"rapidpro.io","size":7719,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"ewheeler:master","ref":"master","sha":"bcc7d689d666ae65b660631cf401a1e0e5256d19","user":{"login":"ewheeler","id":15692,"avatar_url":"https://avatars.githubusercontent.com/u/15692?v=3","gravatar_id":"","url":"https://api.github.com/users/ewheeler","html_url":"https://github.com/ewheeler","followers_url":"https://api.github.com/users/ewheeler/followers","following_url":"https://api.github.com/users/ewheeler/following{/other_user}","gists_url":"https://api.github.com/users/ewheeler/gists{/gist_id}","starred_url":"https://api.github.com/users/ewheeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewheeler/subscriptions","organizations_url":"https://api.github.com/users/ewheeler/orgs","repos_url":"https://api.github.com/users/ewheeler/repos","events_url":"https://api.github.com/users/ewheeler/events{/privacy}","received_events_url":"https://api.github.com/users/ewheeler/received_events","type":"User","site_admin":false},"repo":{"id":20800542,"name":"rapidpro-webhooks","full_name":"ewheeler/rapidpro-webhooks","owner":{"login":"ewheeler","id":15692,"avatar_url":"https://avatars.githubusercontent.com/u/15692?v=3","gravatar_id":"","url":"https://api.github.com/users/ewheeler","html_url":"https://github.com/ewheeler","followers_url":"https://api.github.com/users/ewheeler/followers","following_url":"https://api.github.com/users/ewheeler/following{/other_user}","gists_url":"https://api.github.com/users/ewheeler/gists{/gist_id}","starred_url":"https://api.github.com/users/ewheeler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewheeler/subscriptions","organizations_url":"https://api.github.com/users/ewheeler/orgs","repos_url":"https://api.github.com/users/ewheeler/repos","events_url":"https://api.github.com/users/ewheeler/events{/privacy}","received_events_url":"https://api.github.com/users/ewheeler/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ewheeler/rapidpro-webhooks","description":"","fork":false,"url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks","forks_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/forks","keys_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/teams","hooks_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/hooks","issue_events_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/issues/events{/number}","events_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/events","assignees_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/assignees{/user}","branches_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/branches{/branch}","tags_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/tags","blobs_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/git/refs{/sha}","trees_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/statuses/{sha}","languages_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/languages","stargazers_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/stargazers","contributors_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/contributors","subscribers_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/subscribers","subscription_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/subscription","commits_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/commits{/sha}","git_commits_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/git/commits{/sha}","comments_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/comments{/number}","issue_comment_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/issues/comments{/number}","contents_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/contents/{+path}","compare_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/merges","archive_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/downloads","issues_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/issues{/number}","pulls_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls{/number}","milestones_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/milestones{/number}","notifications_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/labels{/name}","releases_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/releases{/id}","deployments_url":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/deployments","created_at":"2014-06-13T10:19:22Z","updated_at":"2016-05-18T23:47:13Z","pushed_at":"2016-07-11T12:55:56Z","git_url":"git://github.com/ewheeler/rapidpro-webhooks.git","ssh_url":"git@github.com:ewheeler/rapidpro-webhooks.git","clone_url":"https://github.com/ewheeler/rapidpro-webhooks.git","svn_url":"https://github.com/ewheeler/rapidpro-webhooks","homepage":"rapidpro.io","size":7625,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls/4"},"html":{"href":"https://github.com/ewheeler/rapidpro-webhooks/pull/4"},"issue":{"href":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/issues/4"},"comments":{"href":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/ewheeler/rapidpro-webhooks/statuses/180553183f8b7208f3cccf89a938d8723ed3e2ee"}}}}
{"actor":{"display_login":"ewheeler"}}