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}.
Related
I'm trying to get a list / an array of users (username/id) connected to the voice channel of the one who launched the command. I feel like I'm on a good way but I don't find how to do this. for now, I tried message.member.voice.channel.members but It's a long list of information about who is in the channel. I only want their name / tag.
try this:
message.member.voice.channel.members.each(member=>{
console.log(member.user.tag)
})
for more info read official discord.js documentation
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.
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>
I'm a bit confused on how Bot Builder is intended to be used if you want to connect to Slack as well as Kik.
Am I supposed to be using "builder.BotConnectorBot" or will I end up with a "builder.BotConnectorBot" and a separate "builder.SlackBot"? If so, does that mean I'm hosing two separate bots, one for Kik and one for Slack? Or can the same bot built using "builder.BotConnectorBot" be hosted once and work across every channel?
You only need to create a single bot. Just enable it for multiple channels in the portal.
Direct link:
https://dev.botframework.com/bots?id={YourBotId}
You develop one bot and you can use it across multiple channels (skype, slack, FB Messenger, Email, SMS, etc.). This is the main objective of BotFramework to abstract you to the channel implementations.
To add a new channel, you may enter in your bot and BotFramework dev portal and click in the channel you want to add. Some channels (like FB messenger and Slack) may require additional steps to setup the channel.
REF here.
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.