{"action":"created","comment":{"url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls/comments/282152137","pull_request_review_id":235167020,"id":282152137,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI4MjE1MjEzNw==","diff_hunk":"@@ -242,3 +244,52 @@ def get(self, request, *args, **kwargs):\n             return HttpResponseForbidden()\n         else:\n             return Response({'message': 'Authorization was a success'})\n+\n+\n+class SlackActionsCallback(APIView):\n+    authentication_classes = ()\n+    permission_classes = (AllowAny,)\n+\n+    def post(self, request,):\n+        data = request.data\n+        payload = json.loads(data['payload'])\n+        actions = payload.get('actions')\n+\n+        attend_action, action = self.check_action_type(actions, 'attend_event')\n+        if attend_action:\n+            event_id = int(action['value'])\n+            user_slack_id = payload.get('user').get('id')\n+\n+            try:\n+                event = Event.objects.get(id=event_id)","path":"server/api/views.py","position":43,"original_position":43,"commit_id":"debeb3ff75ba223652afcc6ab835a45b2ca9503d","original_commit_id":"debeb3ff75ba223652afcc6ab835a45b2ca9503d","user":{"login":"Alameen688","id":9039613,"node_id":"MDQ6VXNlcjkwMzk2MTM=","avatar_url":"https://avatars3.githubusercontent.com/u/9039613?v=4","gravatar_id":"","url":"https://api.github.com/users/Alameen688","html_url":"https://github.com/Alameen688","followers_url":"https://api.github.com/users/Alameen688/followers","following_url":"https://api.github.com/users/Alameen688/following{/other_user}","gists_url":"https://api.github.com/users/Alameen688/gists{/gist_id}","starred_url":"https://api.github.com/users/Alameen688/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alameen688/subscriptions","organizations_url":"https://api.github.com/users/Alameen688/orgs","repos_url":"https://api.github.com/users/Alameen688/repos","events_url":"https://api.github.com/users/Alameen688/events{/privacy}","received_events_url":"https://api.github.com/users/Alameen688/received_events","type":"User","site_admin":false},"body":"Yes, that is a possible and good approach. I'll do that.","created_at":"2019-05-08T16:43:25Z","updated_at":"2019-05-08T16:43:26Z","html_url":"https://github.com/AndelaOSP/Andela-Socials/pull/181#discussion_r282152137","pull_request_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls/181","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls/comments/282152137"},"html":{"href":"https://github.com/AndelaOSP/Andela-Socials/pull/181#discussion_r282152137"},"pull_request":{"href":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls/181"}},"in_reply_to_id":281960133},"pull_request":{"url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls/181","id":276542952,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjc2NTQyOTUy","html_url":"https://github.com/AndelaOSP/Andela-Socials/pull/181","diff_url":"https://github.com/AndelaOSP/Andela-Socials/pull/181.diff","patch_url":"https://github.com/AndelaOSP/Andela-Socials/pull/181.patch","issue_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/issues/181","number":181,"state":"open","locked":false,"title":"#165717628 User should be able to attend event from slack","user":{"login":"Alameen688","id":9039613,"node_id":"MDQ6VXNlcjkwMzk2MTM=","avatar_url":"https://avatars3.githubusercontent.com/u/9039613?v=4","gravatar_id":"","url":"https://api.github.com/users/Alameen688","html_url":"https://github.com/Alameen688","followers_url":"https://api.github.com/users/Alameen688/followers","following_url":"https://api.github.com/users/Alameen688/following{/other_user}","gists_url":"https://api.github.com/users/Alameen688/gists{/gist_id}","starred_url":"https://api.github.com/users/Alameen688/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alameen688/subscriptions","organizations_url":"https://api.github.com/users/Alameen688/orgs","repos_url":"https://api.github.com/users/Alameen688/repos","events_url":"https://api.github.com/users/Alameen688/events{/privacy}","received_events_url":"https://api.github.com/users/Alameen688/received_events","type":"User","site_admin":false},"body":"#### What Does This PR Do?\r\n\r\n- This PR gives the user the ability to accept an event from slack\r\n#### Description Of Task To Be Completed\r\n\r\n- [x] The slack message sent to a user when an event is created in their category of interest should include an \"Attend\" button\r\n- [x] When a user clicks the \"Attend\" button, they should get a response message indicating whether the action was successful or not\r\n#### Any Background Context You Want To Provide?\r\n - None\r\n#### How can this be manually tested?\r\n- Enable interactivity in the slack app and add a Request URL to the slack app pointing to the endpoint '/api/v1/slack/actions/'\r\n- You might need to add a secure (https) URL as the Request URL. You can use ngrok server to tunnel to localhost then use the secure https URL if testing via localhost\r\n- Follow an interest, you can manually insert this in the `api_interests` table in the db\r\n- Create an event from the client site in a category whose id is the same as that of the interest you followed\r\n- You should get a notification via slack that a new event has been created\r\n- Click the attend button and you should get another message stating that - \"You are now attending the event\"\r\n#### What are the relevant pivotal tracker stories?\r\n[#165717628](https://www.pivotaltracker.com/story/show/165717628)\r\n#### Screenshot(s)\r\n<img width=\"704\" alt=\"Screen Shot 2019-05-07 at 11 24 49 AM\" src=\"https://user-images.githubusercontent.com/9039613/57293498-db7bd880-70bc-11e9-8c88-0b8aaab6312b.png\">\r\n\r\n","created_at":"2019-05-07T10:40:16Z","updated_at":"2019-05-08T16:43:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"32366bff02f1835c7a49bd1160915ccb74801294","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls/181/commits","review_comments_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls/181/comments","review_comment_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/issues/181/comments","statuses_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/statuses/debeb3ff75ba223652afcc6ab835a45b2ca9503d","head":{"label":"AndelaOSP:ft-slack-attend-165717628","ref":"ft-slack-attend-165717628","sha":"debeb3ff75ba223652afcc6ab835a45b2ca9503d","user":{"login":"AndelaOSP","id":22083364,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyMDgzMzY0","avatar_url":"https://avatars1.githubusercontent.com/u/22083364?v=4","gravatar_id":"","url":"https://api.github.com/users/AndelaOSP","html_url":"https://github.com/AndelaOSP","followers_url":"https://api.github.com/users/AndelaOSP/followers","following_url":"https://api.github.com/users/AndelaOSP/following{/other_user}","gists_url":"https://api.github.com/users/AndelaOSP/gists{/gist_id}","starred_url":"https://api.github.com/users/AndelaOSP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndelaOSP/subscriptions","organizations_url":"https://api.github.com/users/AndelaOSP/orgs","repos_url":"https://api.github.com/users/AndelaOSP/repos","events_url":"https://api.github.com/users/AndelaOSP/events{/privacy}","received_events_url":"https://api.github.com/users/AndelaOSP/received_events","type":"Organization","site_admin":false},"repo":{"id":134267092,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQyNjcwOTI=","name":"Andela-Socials","full_name":"AndelaOSP/Andela-Socials","private":false,"owner":{"login":"AndelaOSP","id":22083364,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyMDgzMzY0","avatar_url":"https://avatars1.githubusercontent.com/u/22083364?v=4","gravatar_id":"","url":"https://api.github.com/users/AndelaOSP","html_url":"https://github.com/AndelaOSP","followers_url":"https://api.github.com/users/AndelaOSP/followers","following_url":"https://api.github.com/users/AndelaOSP/following{/other_user}","gists_url":"https://api.github.com/users/AndelaOSP/gists{/gist_id}","starred_url":"https://api.github.com/users/AndelaOSP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndelaOSP/subscriptions","organizations_url":"https://api.github.com/users/AndelaOSP/orgs","repos_url":"https://api.github.com/users/AndelaOSP/repos","events_url":"https://api.github.com/users/AndelaOSP/events{/privacy}","received_events_url":"https://api.github.com/users/AndelaOSP/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/AndelaOSP/Andela-Socials","description":"Andela Socials - Bench Product similar to meetup.com","fork":true,"url":"https://api.github.com/repos/AndelaOSP/Andela-Socials","forks_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/forks","keys_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/teams","hooks_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/hooks","issue_events_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/issues/events{/number}","events_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/events","assignees_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/assignees{/user}","branches_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/branches{/branch}","tags_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/tags","blobs_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/git/refs{/sha}","trees_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/statuses/{sha}","languages_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/languages","stargazers_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/stargazers","contributors_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/contributors","subscribers_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/subscribers","subscription_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/subscription","commits_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/commits{/sha}","git_commits_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/git/commits{/sha}","comments_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/comments{/number}","issue_comment_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/issues/comments{/number}","contents_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/contents/{+path}","compare_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/merges","archive_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/downloads","issues_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/issues{/number}","pulls_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls{/number}","milestones_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/milestones{/number}","notifications_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/labels{/name}","releases_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/releases{/id}","deployments_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/deployments","created_at":"2018-05-21T12:37:01Z","updated_at":"2019-05-06T11:18:52Z","pushed_at":"2019-05-08T15:29:59Z","git_url":"git://github.com/AndelaOSP/Andela-Socials.git","ssh_url":"git@github.com:AndelaOSP/Andela-Socials.git","clone_url":"https://github.com/AndelaOSP/Andela-Socials.git","svn_url":"https://github.com/AndelaOSP/Andela-Socials","homepage":"http://staging-socials.andela.com/","size":16546,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":10,"license":null,"forks":2,"open_issues":10,"watchers":6,"default_branch":"develop"}},"base":{"label":"AndelaOSP:mvp-develop","ref":"mvp-develop","sha":"6dfc3b849ed75dfaa5650ab10dd62d227342b5a5","user":{"login":"AndelaOSP","id":22083364,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyMDgzMzY0","avatar_url":"https://avatars1.githubusercontent.com/u/22083364?v=4","gravatar_id":"","url":"https://api.github.com/users/AndelaOSP","html_url":"https://github.com/AndelaOSP","followers_url":"https://api.github.com/users/AndelaOSP/followers","following_url":"https://api.github.com/users/AndelaOSP/following{/other_user}","gists_url":"https://api.github.com/users/AndelaOSP/gists{/gist_id}","starred_url":"https://api.github.com/users/AndelaOSP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndelaOSP/subscriptions","organizations_url":"https://api.github.com/users/AndelaOSP/orgs","repos_url":"https://api.github.com/users/AndelaOSP/repos","events_url":"https://api.github.com/users/AndelaOSP/events{/privacy}","received_events_url":"https://api.github.com/users/AndelaOSP/received_events","type":"Organization","site_admin":false},"repo":{"id":134267092,"node_id":"MDEwOlJlcG9zaXRvcnkxMzQyNjcwOTI=","name":"Andela-Socials","full_name":"AndelaOSP/Andela-Socials","private":false,"owner":{"login":"AndelaOSP","id":22083364,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyMDgzMzY0","avatar_url":"https://avatars1.githubusercontent.com/u/22083364?v=4","gravatar_id":"","url":"https://api.github.com/users/AndelaOSP","html_url":"https://github.com/AndelaOSP","followers_url":"https://api.github.com/users/AndelaOSP/followers","following_url":"https://api.github.com/users/AndelaOSP/following{/other_user}","gists_url":"https://api.github.com/users/AndelaOSP/gists{/gist_id}","starred_url":"https://api.github.com/users/AndelaOSP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndelaOSP/subscriptions","organizations_url":"https://api.github.com/users/AndelaOSP/orgs","repos_url":"https://api.github.com/users/AndelaOSP/repos","events_url":"https://api.github.com/users/AndelaOSP/events{/privacy}","received_events_url":"https://api.github.com/users/AndelaOSP/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/AndelaOSP/Andela-Socials","description":"Andela Socials - Bench Product similar to meetup.com","fork":true,"url":"https://api.github.com/repos/AndelaOSP/Andela-Socials","forks_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/forks","keys_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/teams","hooks_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/hooks","issue_events_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/issues/events{/number}","events_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/events","assignees_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/assignees{/user}","branches_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/branches{/branch}","tags_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/tags","blobs_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/git/refs{/sha}","trees_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/statuses/{sha}","languages_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/languages","stargazers_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/stargazers","contributors_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/contributors","subscribers_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/subscribers","subscription_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/subscription","commits_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/commits{/sha}","git_commits_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/git/commits{/sha}","comments_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/comments{/number}","issue_comment_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/issues/comments{/number}","contents_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/contents/{+path}","compare_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/merges","archive_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/downloads","issues_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/issues{/number}","pulls_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls{/number}","milestones_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/milestones{/number}","notifications_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/labels{/name}","releases_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/releases{/id}","deployments_url":"https://api.github.com/repos/AndelaOSP/Andela-Socials/deployments","created_at":"2018-05-21T12:37:01Z","updated_at":"2019-05-06T11:18:52Z","pushed_at":"2019-05-08T15:29:59Z","git_url":"git://github.com/AndelaOSP/Andela-Socials.git","ssh_url":"git@github.com:AndelaOSP/Andela-Socials.git","clone_url":"https://github.com/AndelaOSP/Andela-Socials.git","svn_url":"https://github.com/AndelaOSP/Andela-Socials","homepage":"http://staging-socials.andela.com/","size":16546,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":10,"license":null,"forks":2,"open_issues":10,"watchers":6,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls/181"},"html":{"href":"https://github.com/AndelaOSP/Andela-Socials/pull/181"},"issue":{"href":"https://api.github.com/repos/AndelaOSP/Andela-Socials/issues/181"},"comments":{"href":"https://api.github.com/repos/AndelaOSP/Andela-Socials/issues/181/comments"},"review_comments":{"href":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls/181/comments"},"review_comment":{"href":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AndelaOSP/Andela-Socials/pulls/181/commits"},"statuses":{"href":"https://api.github.com/repos/AndelaOSP/Andela-Socials/statuses/debeb3ff75ba223652afcc6ab835a45b2ca9503d"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Alameen688"}}