Updating a chat channel without update message? - getstream-io

We update channels server-side using JS.
How can we update a channel without posting a message in the chat?
https://getstream.io/chat/docs/channel_update/?language=js

Signature is like as following:
channel.update(new_channel_data_object_to_be_merged, optional_update_message)
Since message is optional, you can skip it and by only providing data, you can update a channel.

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

How can I get channel information inside Bot composer

I am building a bot using the Bot composer that is registered across channels. I want to capture and log the channel information, such as the channel source (Telegram, Line). Is it possible to do that?
You can see it in turn.activity.channelId
To view complete Json payload use ${turn.Activity} and for the channel source you can use ${turn.Activity.channelId}.

Discord.js - Send a message when a channel is deleted

Just wondering if it's possible to send a user a dm with a bot when a channel is deleted.
Yes, it is, using client events. This question is quite vague and non-code specific so you should head to the Discord.JS discord server for questions like this (avail. on their website).

notifying #channel in slack via azure logic app

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>

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