Slack User removed event - bots

I developing a slackbot and have implemented events
just like a applied event on member joining channel
https://api.slack.com/events/member_joined_channel
I need an event when user is being removed from team

This kind of event currently does not exist. Check this list for an overview of all existing events.
Please contact the Slack team and suggest this event for a possible future implementation at feedback#slack.com.

Related

How to proactively send a message to a teams channel

I can't seem to figure out how to proactively message a MS teams channel using a Python Bot (botframework).
An user installs my third-party MS teams bot, adding it to one of their Teams channels.
My Bot needs to send ad-hoc messages as part of an event from an unrelated back-end system.
The botframework does not let you message channels at will, it needs a conversation reference. You can get a conversation reference in various ways, such as someone messaging the bot, or fetching the list of channels and constructing a conversationId from that.
Reading the documentation
The documentation will have you believe that it is in fact possible to send message at will, using the following steps:
Get the user ID or team/channel ID (if needed).
Create the conversation or conversation thread (if needed).
Get the conversation ID.
Send the message.
For step 1, how/when do I get the channel ID if there are no events that my Bot has been added to a channel?
For step 2, how do I create a conversation if I don't know what team channels there are?
Conclusion
Does someone know how to send a message to a MS Teams channel using a Python app/bot? It should not require user interaction. The app/bot gets added to a Teams channel, and it should immediately post a message inside this channel.
Turns out the issue was that my on_teams_members_added() was not getting called because I kept deleting the app within Teams instead of uninstalling.
Make sure to:
Click on the ... overflow menu next to the team name
Pick Manage Team
Select the "Apps" tab
Click the trash icon to remove the app from that team
Then try to install the app again
With this code you can send a channel message when the Bot enters the channel:
async def on_teams_members_added( # pylint: disable=unused-argument
self,
teams_members_added: [TeamsChannelAccount],
team_info: TeamInfo,
turn_context: TurnContext,
):
for member in teams_members_added:
if member.id == turn_context.activity.recipient.id and team_info is not None:
# bot entered a Teams channel
await turn_context.send_activity("Hello channel! I have just been added.")
Your handler needs to inherit from TeamsActivityHandler.
I'm working on a sample for the pnp Teams samples repo on GitHub that I'm hoping to submit in the next few days. I haven't started on the documentation yet, but the code is fully functional, with both a C# and a Node.js version of the backend, which sends a -very- simple proactive message example (showing the most basic things you need) - hopefully it can be of use even though it's not in Python - see https://github.com/HiltonGiesenow/teams-dev-samples/tree/add-proactive-messaging-sample/samples/bot-proactive-messaging/src

Google Hangouts Chatbot Create Room

I am writing service for messaging between rooms using Hangouts chatbot. Is it possible to create a room with Hangouts chatbot?
https://developers.google.com/hangouts/chat/concepts
If it were generally possible to create a new room programmaticaly with the Hangous API, you could do it with the chatbot.
For example, if you implement the chatbox with Apps Script, you can create a function onMessage(event) and establish was will to happen in case of a certain event.message.text (e.g. create a new chat room if the message text contains the string create new room.
However, for the moment it is not possible to create a new chat room programmatically.
There is a feature request asking for this functionality, but given the potential of abuse, it is controversial either it will be implemented.
See comment #2:
Hello, thank you for the feature request! At the moment rooms cannot
be created via the API to prevent abuse such as a bot or script
spamming room creation. However, this kind of feature has been
discussed internally and may be coming in the future (with
limitations). I will update this issue if more information is
released.
And comment #25:
Thanks for the input. It's great to see some real life use cases. We
fully acknowledge the importance of a CreateRoom(DM) API and we are
actively looking into the right permission model to allow bots to do
so. Please continue to follow this bug as we will post updates here
when appropriate.

How to create a custom event in Policy Center

I was asked to create a custom event in Policy Center. A GuideWire employee said that I should see the GuideWire docs. I searched the documents that I had and all I could find was how to add a new event for something in Billing Center. It seemed to suggest that I should add the new event to the type list. There doesn't seem to be a type list for the other types of events that I am monitoring, so that doesn't seem to be an option.
This should be as simple as calling
.addEvent("CustomeEvent")
on any entity object.
What you probably should read is the Messaging section of the Integration Guide in the documentation. This new event - whatever you call it - has to be mentioned in Messaging part of the configuration on the particular destination and then appropriately filtered/handled in Event Fired Rules.

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.

Telegram Bot Event When Users Join To Channel

After create telegram bot, access and admin this bot to channel. how to get channel members list or event when users join to this channel?
Pretty disappointed with the current answers, so I'll leave an updated (as of February 2018) answer that explains how to do this with the Telegram API itself, as well as with the framework I am using, Telegraf for Node.
The Telegram API is both very powerful, and pretty simple as far as API's go. If you are using the polling method of getting updates, and not websockets which are a whole other issue, checking if someone new has been added to a group or channel is very easy.
The API method getUpdates returns an array of Update objects, which contain all of the possible information you could want including any messages sent, inline queries, and new chat members. To get any new chat members you simply need to access update.message.new_chat_members which will contain an array of new users. For reference you can look in the API documentation here.
To fetch the update objects in browser, or with curl, all you have to do is send a GET or POST request to https://api.telegram.org/botYOUR-BOT-TOKEN/getUpdates. Then just look for messages->new_chat_members.
If you are using the Telegraf bot framework with NodeJs you can use the bot.on method with the event new_chat_members.
Example:
bot.on('new_chat_members', (ctx) => console.log(ctx.message.new_chat_members))
I know this was asked a while ago, but I hope this helps other people searching.
From docs:
new_chat_members New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
So i think you can't.
To get updates on users join group or channel you must correctly setup webhook for your bot. This update type is disabled by default. See https://core.telegram.org/bots/api#setwebhook
allowed_updates
A JSON-serialized list of the update types you want your bot to
receive. For example, specify [“message”, “edited_channel_post”,
“callback_query”] to only receive updates of these types. See Update
for a complete list of available update types. Specify an empty list
to receive all update types except chat_member (default). If not
specified, the previous setting will be used.
Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received
for a short period of time.
So, the request should look like this:
https://api.telegram.org/<BOT_TOKEN>/setWebhook?url=<WEBHOOK_URL>&allowed_updates=["chat_member"]
Yes! You can use this:
https://api.telegram.org/bot[TOKEN]/promoteChatMember?chat_id=#[channelname]&user_id=[user_id]
if user is joined response is ok, else response is not ok.

Resources