notifying #channel in slack via azure logic app - azure

I tried notifying the user in a channel using user ID (for eg. hey <#U123456|bob>, how are you?). here #U123456 is the user ID.
This is getting notified by the user.
But when i try to notify <#C123456|channel>, its not notifying. here #C123456 is the channel ID and channel is the default tag that is used to notify all the users in that channel.
#channel is used to notify all the users in a particular channel. I am failing at it.
Please help.

The problem has been resolved,
<#C1234567> isn't a valid way to notify a channel, instead use <!channel> within that channel to trigger a notification.
https://api.slack.com/docs/message-formatting#variables

Can you try using the actual channel name instead of the default channel tag?
<#C123456|REALCHANNELNAME>

Related

How to use the Discord JS Client without logging in?

I have a service that listens for certain updates and then uses a Discord Bot to post a message on a channel. A random example: every time a team scores a goal, post a message in a channel. I got an email from Discord to reset my bot token because there were too many logins.
As you know, in order to use the Bot you use the client.login("XXX") method. So every time there is an update my service initializes the bot and then sends a message. My assumption is that it has to do with me calling client.login("XXX") for every update. Since my service runs serverless, I can not keep the service up.
Is there a way to make the bot post a message without having to use client.login("XXX")? Or can anyone suggest any strategy to make this logic work?
That is not possible as a bot cannot do any actions without being logged in, it sounds like channel webhooks would fit your needs better.
You simply generate a webhook link in a channel which you can then post messages to through a post request.
You can read more about webhooks here
And you can read more about the required paramters and how to format a POST request to the webhook here

Discord.js how can bot ping when someone with a specific role leave

I made a bot and I want to add a feature to my bot. ping a specific room when people with a custom role leave the server. So, for example, we'll know when people with the "partner" role come out.
I wanna write code in index.js.
Lemme tell you this isn't much related to discordjs itself, but the way discord client works. You should not probably ping a user who has left the server, as uncached users on mobile or any user may show as invalid user. Therefore you should log username#discriminator, or actually tag and then user id incase you want to keep the record of their IDs for future ping, etc.
Edit after you commented:
There's guildMemberRemove event for your client bot.
Info: https://discord.js.org/#/docs/discord.js/stable/class/Client?scrollTo=e-guildMemberRemove
It emits member object, and you can get that user's name, etc from that. You can make the bot dm you, or send a message in a specific channel, and ping you.
Important Notice: keep your bot private, in your server only, or else, add a if condition to check whether the member who left was from your specific server or not, or else the bot may log that user even if he didn't leave your own server.
In guildMemberRemove event you can specify the alert message.
Check member has a role or not then send your message in right situation.

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

Send private message to a slackbot without other users of the workspace seeing it

How can i send a private message to a bot other without users seeing it on the channel?
Im using node js and the module slackbots. And each time i communicate with the bot it goes something like this: "#robot hello" but everybody on the chat sees it.
Your example is not a direct message, but a so called "mention" in a channel, which is always visible by everyone else in the same channel.
But you can also send a real direct message to a bot user. It works the same like sending a direct message to any user. e.g. click on the plus next to "Direct Messages", select the bot user from the list and click on go. Now you got a direct messaging channel with that user which is 100% private.
Your bot obviously needs to be ready to receive messages via DM in order to respond correctly. e.g if your are using Slack's Events API you need to subscribe to message.im to receive posts in the direct message channel to your bot.
Check out this help desk page on how to send direct messages.
Another approach to communicate "secretly" with your bot user in a channel is slash commands, e.g. by posting /mybot hi in a channel. Both the slash command and respond from your app will not be visible to anyone else in the channel (that is default - but can be changed).

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.

Resources