file_share does not work, fire_shared fired twice
Hi,
I use botkit to listen to a channel to capture the shared files, I used to use file_share one year ago. it worked well. But now, it does not go to file_share when I shared a file (upgraded botkit lib). I changed to use file_shared but it fired twice on some channels. my sample codeL
var Botkit = require('Botkit');
var controller = Botkit.slackbot({
debug: true,
});
var bot = controller.spawn({
token: '...'
}).startRTM();
controller.on('file_shared', function(bot, message) {
console.log(message);
});
/*
//no longer works
controller.on('file_share', function(bot, message) {
console.log(message);
});
*/
the output
...
notice: RTM websocket opened
debug: RECEIVED MESSAGE
debug: CUSTOM FIND CONVO undefined undefined hello
debug: RECEIVED MESSAGE
debug: CUSTOM FIND CONVO undefined undefined file_public
debug: RECEIVED MESSAGE
debug: CUSTOM FIND CONVO undefined undefined file_public
debug: RECEIVED MESSAGE
debug: CUSTOM FIND CONVO undefined undefined file_shared
{ type: 'file_shared',
channel_id: '...',
file_id: '...',
user_id: '...',
file: { id: '...' },
event_ts: '1536945919.000200',
raw_message:
{ type: 'file_shared',
channel_id: '..',
file_id: '...',
user_id: '...',
file: { id: '...' },
event_ts: '1536945919.000200' },
_pipeline: { stage: 'receive' } }
debug: RECEIVED MESSAGE
debug: CUSTOM FIND CONVO undefined undefined file_shared
{ type: 'file_shared',
channel_id: '...',
file_id: '',
user_id: '',
file: { id: '...' },
event_ts: '1536945919.000300',
ts: '1536945919.000300',
raw_message:
{ type: 'file_shared',
channel_id: '...',
file_id: '..',
user_id: '..',
file: { id: '...' },
event_ts: '1536945919.000300',
ts: '1536945919.000300' },
_pipeline: { stage: 'receive' } }
Does anyone know what happened?
Duplicate of #1434
https://api.slack.com/events/message/file_share
This event will be deprecated in July 2018. In the RTM API, it will no longer dispatch. In the Events API, subscriptions and deliveries will continue until further notice.
@Naktibalda , thanks for the answer Are you referring file_share or file_shared depreciation? How about the issue with file_shared? Also, what is the alternative solution for catching the shared file in RTM using botkit? Thanks
file_share is a deprecated one. file_shared works on RTM (according to documentation and your experience).
I have no idea what's causing your issue with duplicated events, but it looks more like an issue of Slack than an issue of Botkit, because those are different events and not the same event fired twice.