Slack webhook API file_created and file_shared - webhooks

I am working with slack webhook. Trying to understand the event API.
I am getting confused with file_created and file_shared events. What is the difference between them? Gone through the official documentation but did not worked for me.
Also, we receive file_id and id when an event is triggered, both ids are same. Is there any difference between them?
use cases always help to understand :)

The file_created event is triggered once a new file is uploaded. At this point also a new file_id for that file is created.
Files belong to a user and will not be visible to anyone on a Slack workspace until it is shared in a conversation or channel.
Once a file is shared in a channel / conversation the file_shared event is triggered. Sharing a file can be done during the initial upload (which usually is the case - so both events will occur together) or later.
The same file can be also be shared in multiple channels and each time the file_shared event will be triggered.

Related

How to create a bot in lex/azure that respond in slack threads?

I have created 2 chatbots using AWS lex and Azure bot framework each. I have integrated them with slack and they respond to the mentions in channels.
Currently, the bot responds as a new message however I want it to respond in the slack thread of the original message posted by the user. I tried to look for articles in various places but could not find anything helpful. Does anyone have any idea on how to achieve this or a reference to a GitHub repo for a sample?
Since you are able to post replies, I am assuming that you are using chat.postMessage API.
https://api.slack.com/methods/chat.postMessage
To send the reply as a thread, all you need to do is that add thread_ts argument in the api call.
(Provide original message's ts (timestamp) value to make this message a reply.)

How to encounter reply when user attaches a document/image to a chatbot(Build with dialogflow and kommunicate)?

I have tried many different methods but it is not working properly.Please any one can help me how to send a reply when user uploads any attachments in a chatbot.
To be able to achieve your objective, it is important to understand what dialogflow events are: Events allow you to invoke intents based on something that has happened instead of what a user communicates. Dialogflow supports events from several platforms (like Google Assistant, Slack, and more) based on actions users take on those platforms.
When a user attaches a file or shares location, Kommunicate sends a custom event KOMMUNICATE_MEDIA_EVENT to your bot along with the attached file information. To have an upload intent respond to the KOMMUNICATE_MEDIA_EVENT, follow these steps to create this custom event in your dialogflow bot:
How to add an event to an intent
Go to the Events section of the intent.
Type the name of the event you'd like your intent to respond to (KOMMUNICATE_MEDIA_EVENT).
Press enter.
Click SAVE.
Also remember to add your response that the bot will deliver to a user when they upload a document.
References:
https://cloud.google.com/dialogflow/docs/events-overview
https://docs.kommunicate.io/docs/bot-custom-integration#send-attachments-to-bot
https://cloud.google.com/dialogflow/docs/quick/build-agent
I hope this helps?

Slack #here mention in channel via Incoming webhook

So I have an alert channel that collects messages from slack via incoming webhook. It's one of many tools we use to monitor these couple of apps that normally run without issue, but if there is a problem we want to know right away so we can do something about it. I'm getting emails, etc. but I also want the channel wide slack messages.
What I'm trying to do seems simple enough, but it's not working. I want to trigger an #channel or #here message to alert all the users in the channel at the time, so if the error happens in an environment that matters everyone gets a notification. I'm following examples in the documentation using the <#ABC123> channel id but it's not translating into an #here directive, it's just plain text.
Either what I'm doing can't be done, or more likely I'm missing something somewhere or approaching this incorrectly. I'm guessing it's the latter, but at this point confirmation that I can't do what I'm trying to do is fine, I'll come up with something else.
Found it
Apparently the convention for the channel alerts are <!channel>, not <#C123> as is with users or channel ids, or <#channel> with channel mentions (though that does work, just not as a channel wide alert). Hope this helps someone eventually.

API.AI A bot that starts the conversation

I am just now creating my first bot for my own use, and I want
to gather user information and search through my database for it.
I figured the best way for this is just to ask the question before the user
starts the conversation. Does anyone know how I can accomplish this (getting the bot to send a message first)?
Trigger an event as soon as user comes to the chat bot platform - see https://api.ai/docs/events. Nearly all platforms triggers an event for users first time. Check the facebook bot docs.
There is provision to do so in api.ai. The event is a feature that allows you to invoke intents by an event name instead of a user query. You just need to define event names for intents. Then, you can trigger these intents by sending a /query request containing an event parameter.

Twilio: Purging media resources older than a certain time automatically

Everytime we send an image MMS with Twilio, they keep a copy of the image on their server.
Does Twilio have a API function or an account setting to delete image resources older than a certain time (rather than deleting them one by one with the Delete Media Resource API)?
Thanks!
Twilio developer evangelist here.
There is no account setting to delete images automatically, based on time or anything else. As the documentation says (emphasis mine):
Twilio will keep that media around until you issue an HTTP DELETE on that instance.
Every time you send a message you could schedule a job to run in the future to then delete that message's media. That way you are in control of deletion when you want it to happen.

Resources