Error when it gets invited into a channel
When I invite the bot into a channel, I get the following error message in the console and the process stops:
2016/10/29 19:42:35 json: cannot unmarshal object into Go value of type string
I already applied #3.
Ok, the problem is, that for regular slack events (message, etc.), channel is a string. But when you get the channel_joined event, channel is an object with information about the channel. Therefore GO can't fill the struct and fails.
Here is the raw data of the two events I receive when I invite my bot into a channel:
{"type":"channel_joined","channel":{"id":"C052LFU5N","name":"code","is_channel":true,"created":1432794048,"creator":"U04V7ARLN","is_archived":false,"is_general":false,"is_member":true,"last_read":"1477772629.000007","latest":{"user":"U2VTZ5U64","text":"<@U2VTZ5U64|my_bot> has left the channel","type":"message","subtype":"channel_leave","ts":"1477772629.000007"},"unread_count":0,"unread_count_display":0,"members":["U04V7ARLN","U2VTZ5U64"],"topic":{"value":"","creator":"","last_set":0},"purpose":{"value":"","creator":"","last_set":0}}}
{"user":"U2VTZ5U64","inviter":"U04V7ARLN","user_profile":{"avatar_hash":"3c0d22192158","image_72":"https://avatars.slack-edge.com/2016-10-29/97900532003_3c0d22192158ab559938_72.png","first_name":null,"real_name":"","name":"my_bot"},"type":"message","subtype":"channel_join","team":"T04V7ARLC","text":"<@U2VTZ5U64|my_bot> has joined the channel","channel":"C052LFU5N","ts":"1477774072.000008"}
Same problem with team_join and user_change events because they have objects in the user key and not strings.