{"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":11,"created_at":"2016-08-15T11:42:25Z","updated_at":"2016-08-17T15:27:56Z","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/240448863","html_url":"https://github.com/Microsoft/BotBuilder/issues/998#issuecomment-240448863","issue_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/998","id":240448863,"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-17T15:27:56Z","updated_at":"2016-08-17T15:27:56Z","body":"Minimal repro is actually quite easy:\r\n\r\n```\r\nreply.ChannelData = new {text = \"here should be attachments\"};\r\nconnector.Conversations.ReplyToActivityAsync(reply);\r\n```\r\n\r\n1. `JsonConvert.SerializeObject(reply)` shows \r\n\r\n         \"channelData\": {\"text\": \"here should be attachments\" }\r\n\r\n2. `IServiceClientTracingInterceptor` logs `EnterMethod` for `ReplyToActivity` with\r\n\r\n         ChannelData: {text: \"here should be attachments\"}\r\n\r\n3. `IServiceClientTracingInterceptor` logs `SendRequest` with\r\n\r\n         \"channelData\": {}\r\n\r\n4. delegating handler logs\r\n\r\n         \"channelData\": {}\r\n\r\nIt boils down (I think, at least) to [this line](https://github.com/Microsoft/BotBuilder/blob/c4dbb7183cc1c23837b6d6c8bc03fe8c54ba1f55/CSharp/Library/Microsoft.Bot.Connector/ConnectorAPI/Conversations.cs#L563) in `Microsoft.Bot.Connector.Conversations.ReplyToActivityWithHttpMessagesAsync`:\r\n\r\n      _httpRequest.Content = (HttpContent) new StringContent(SafeJsonConvert.SerializeObject((object) activity, this.Client.SerializationSettings), Encoding.UTF8);\r\n\r\nwhich for some reason serializes `channelData` as empty object."}}
{"actor":{"display_login":"srogovtsev"}}