{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/998","repository_url":"https://api.github.com/repos/Microsoft/BotBuilder","labels_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/998/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/998/comments","events_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/998/events","html_url":"https://github.com/Microsoft/BotBuilder/issues/998","id":171155099,"number":998,"title":"Can't send custom Slack Message with version 3 of Bot Connector","user":{"login":"srogovtsev","id":2332517,"avatar_url":"https://avatars.githubusercontent.com/u/2332517?v=3","gravatar_id":"","url":"https://api.github.com/users/srogovtsev","html_url":"https://github.com/srogovtsev","followers_url":"https://api.github.com/users/srogovtsev/followers","following_url":"https://api.github.com/users/srogovtsev/following{/other_user}","gists_url":"https://api.github.com/users/srogovtsev/gists{/gist_id}","starred_url":"https://api.github.com/users/srogovtsev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srogovtsev/subscriptions","organizations_url":"https://api.github.com/users/srogovtsev/orgs","repos_url":"https://api.github.com/users/srogovtsev/repos","events_url":"https://api.github.com/users/srogovtsev/events{/privacy}","received_events_url":"https://api.github.com/users/srogovtsev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"craigjensen","id":18585246,"avatar_url":"https://avatars.githubusercontent.com/u/18585246?v=3","gravatar_id":"","url":"https://api.github.com/users/craigjensen","html_url":"https://github.com/craigjensen","followers_url":"https://api.github.com/users/craigjensen/followers","following_url":"https://api.github.com/users/craigjensen/following{/other_user}","gists_url":"https://api.github.com/users/craigjensen/gists{/gist_id}","starred_url":"https://api.github.com/users/craigjensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craigjensen/subscriptions","organizations_url":"https://api.github.com/users/craigjensen/orgs","repos_url":"https://api.github.com/users/craigjensen/repos","events_url":"https://api.github.com/users/craigjensen/events{/privacy}","received_events_url":"https://api.github.com/users/craigjensen/received_events","type":"User","site_admin":false},"assignees":[{"login":"craigjensen","id":18585246,"avatar_url":"https://avatars.githubusercontent.com/u/18585246?v=3","gravatar_id":"","url":"https://api.github.com/users/craigjensen","html_url":"https://github.com/craigjensen","followers_url":"https://api.github.com/users/craigjensen/followers","following_url":"https://api.github.com/users/craigjensen/following{/other_user}","gists_url":"https://api.github.com/users/craigjensen/gists{/gist_id}","starred_url":"https://api.github.com/users/craigjensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craigjensen/subscriptions","organizations_url":"https://api.github.com/users/craigjensen/orgs","repos_url":"https://api.github.com/users/craigjensen/repos","events_url":"https://api.github.com/users/craigjensen/events{/privacy}","received_events_url":"https://api.github.com/users/craigjensen/received_events","type":"User","site_admin":false}],"milestone":null,"comments":9,"created_at":"2016-08-15T11:42:25Z","updated_at":"2016-08-17T09:20:59Z","closed_at":null,"body":"I have a bot that replies with a message consisting only of attachments. When it works on Slack, it uses Slack attachment formatting quite heavily, thus I have to use `ChannelData` property.\r\n\r\nIn version 1 of BotConnector, the code was like this\r\n\r\n        var reply = message.CreateReplyMessage();\r\n        reply.Attachments = new List<Attachment>();\r\n        var attachments = new List<object>(); //Slack-formatted attachments\r\n        //filling attachments...\r\n        reply.ChannelData = new {attachments};\r\n\r\nand it worked. Now, in version 3 code has changed to\r\n\r\n        var reply = activity.CreateReply();\r\n        reply.Attachments = new List<Attachment>();\r\n        var attachments = new List<object>(); //Slack-formatted attachments\r\n        //filling attachments...\r\n        reply.ChannelData = new {attachments};\r\n\r\n        var connector = new ConnectorClient(new Uri(activity.ServiceUrl));\r\n        await connector.Conversations.ReplyToActivityAsync(reply);\r\n\r\nwhich, basically, boils down to using different method to create reply, and another one to send the reply back.\r\n\r\nNow, the problem is, that I don't get the reply back to Slack. Diagnostics in AppInsight show me that somewhere in Connector something like this happens:\r\n\r\n>     Exception type: System.ArgumentNullException\r\n>     Failed method: SlackChannel.SlackMapper+d__5.MoveNext\r\n>     Exception Message: value cannot be null. Parameter name: source\r\n>     ChannelData: {}\r\n>     message: Invalid ChannelData\r\n\r\nPlease note that `ChannelData` in this diagnostics seems to be empty. So what I gather from all this is that something has changed in the way BotConnector processes `ChannelData`. How can I find out what exactly am I doing wrong?\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/comments/240359148","html_url":"https://github.com/Microsoft/BotBuilder/issues/998#issuecomment-240359148","issue_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/998","id":240359148,"user":{"login":"srogovtsev","id":2332517,"avatar_url":"https://avatars.githubusercontent.com/u/2332517?v=3","gravatar_id":"","url":"https://api.github.com/users/srogovtsev","html_url":"https://github.com/srogovtsev","followers_url":"https://api.github.com/users/srogovtsev/followers","following_url":"https://api.github.com/users/srogovtsev/following{/other_user}","gists_url":"https://api.github.com/users/srogovtsev/gists{/gist_id}","starred_url":"https://api.github.com/users/srogovtsev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srogovtsev/subscriptions","organizations_url":"https://api.github.com/users/srogovtsev/orgs","repos_url":"https://api.github.com/users/srogovtsev/repos","events_url":"https://api.github.com/users/srogovtsev/events{/privacy}","received_events_url":"https://api.github.com/users/srogovtsev/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T09:20:59Z","updated_at":"2016-08-17T09:20:59Z","body":"What do you mean by \"properly formatted\"? Does it have to be a complete Slack message with addressing and so on? Because example message on your link isn't complete, it has only `text` and `attachments`, no addressing.\r\n\r\n> Try changing your code to something like:\r\n\r\nIt won't compile: `JObject` has no property `Attachments`. But let's try changing it to `dynamic`:\r\n\r\n```\r\ndynamic channelData = new JObject();\r\nchannelData.Attachments = new JArray(attachments);\r\nreply.ChannelData = channelData;\r\n```\r\n\r\nIt fails with \r\n\r\n```\r\nSystem.ArgumentException: Could not determine JSON object type for type <>f__AnonymousType7`13[System.String,System.String,System.String,System.String,System.String,System.String,System.String,<>f__AnonymousType2`3[System.String,System.String,System.Boolean][],System.String,System.String,System.Int64,System.String,System.Object[]].\r\n   at Newtonsoft.Json.Linq.JValue.GetValueType(Nullable`1 current, Object value)\r\n   at Newtonsoft.Json.Linq.JContainer.CreateFromContent(Object content)\r\n   at Newtonsoft.Json.Linq.JContainer.AddInternal(Int32 index, Object content, Boolean skipParentCheck)\r\n   at Newtonsoft.Json.Linq.JContainer.AddInternal(Int32 index, Object content, Boolean skipParentCheck)\r\n   at Aqu.Web.MessagesController.<Post>d__4.MoveNext() in C:\\repos\\srogovtsev\\aqu\\Sources\\Aqu.Web\\Controllers\\MessagesController.cs:line 251\r\n```\r\n\r\nBut if I go back to my simple `reply.ChannelData = new {attachments};`, I get (at least on my side, just before sending) a valid JSON:\r\n\r\n        \"ChannelData\": {\r\n          \"attachments\": [\r\n            {\r\n              \"author_name\": \"XXX\",\r\n              \"author_icon\": \"https://secure.gravatar.com/avatar/XXX\",\r\n              \"color\": \"#14892c\",\r\n              \"fallback\": \"XXX\",\r\n              \"title\": \"XXX\",\r\n              \"title_link\": \"https://xxx\",\r\n              \"text\": \"XXX\",\r\n              \"fields\": [\r\n                {\r\n                  \"title\": \"Assigned to\",\r\n                  \"value\": \"XXX\",\r\n                  \"short\": false\r\n                },\r\n                {\r\n                  \"title\": \"Fix version/s\",\r\n                  \"value\": \"XXX\",\r\n                  \"short\": true\r\n                }\r\n              ],\r\n              \"footer\": \"Bug\",\r\n              \"footer_icon\": \"https://XXX\",\r\n              \"ts\": 1471265352.0,\r\n              \"callback_id\": null,\r\n              \"actions\": null\r\n            }\r\n          ]\r\n        }"}}
{"actor":{"display_login":"srogovtsev"}}