I'm using Azure Bot Channels Registration for my bot, I have working endpoint and bot works well in Web Chat and My settings are:
Display Name: Engine Crave
Invocation Name: Engine Crave
Long Desc, Short Desc etc are all correct and filled and also organization at the last is also selected.
Also, My bot takes no user permissions. But when I save the Cortana Channel, I get a popup:
Unable to save.
There was an error saving the channel:
Failed to create bot module. Trace Id : 87140f58-46f8-4101-a849-17d63af6831c
Trace ID always keeps changing whenever I try.
Pls help!
Yayay! I found answer myself. Go-to settings and make display name same as your bot registration name when you registered on Azure! Mine was crave-engine.
Next goto Channels Registration -> Cortana -> Here you will see
Display Name: crave-engine
Invocation Name: crave-engine
Let these be like this and just click the "Register" button at the bottom. It's ok for now, You can however change these names When you register from https://knowledge.store .
I don't know these was some kind of bug or Azure Bot Team did this on purpose!
Related
Heres the error message:
PS C:\Users\User\Documents\Discord Bot> node .
ready
C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:154
throw new DiscordAPIError(request.path, data, request.method, res.status);
^
DiscordAPIError: Missing Access
at RequestHandler.execute (C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
at processTicksAndRejections (node:internal/process/task_queues:93:5)
at async RequestHandler.push (C:\Users\User\Documents\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:39:14) {
method: 'post',
path: '/applications/723863781607997451/guilds/722043668730740788/commands',
code: 50001,
httpStatus: 403
}
Help is appreciated.
This is my first post on stackoverflow, so if I'm posting something wrong, please tell me!
This error is caused because your Discord Bot does not have permission to create commands for that server.
There is two ways to fix this.
Option 1 - In-App Authorization
You should first navigate to the Discord Developer Portal then you should click on the bot that you are getting the issue with.
You will then be prompted with this page:
You should then click on the "OAuth" page, highlighted in red on the above screenshot.
Once you are on this page, you should find the "Default Authorization Link" setting and set it to "In-App Authorization".
Once that option is selected another option will pop up asking what permissions the bot will ask the user for, you can see the screenshot below.
Select bot and application.commands then select the permissions that your bot requires.
Then save your changes.
You will need to re-authorize your bot to the guild before it will work, you do not need to kick it - just click on your bot and click "Add to Server" and re-add it to your guild.
Option 2 - URL Generation
You should first navigate to the Discord Developer Portal then you should click on the bot that you are getting the issue with.
Once you are on that page, you should access the OAuth sub-menu titled "URL Generation" as seen below.
Once you are on this page, you will be presented with a similar output to Option 1, you should configure the scope to be bot and application.commands and then request permissions as your bot needs.
Note
You should use both of these with your Discord bot, you should use Option 1 to setup your in-app authorization permissions and then use Option 2 to get a URL for Discord Bot lists, etc.
I'm working on a chatbot with botframework.which has been deployed to teams channel.
In the microsoft teams app, my bot keeps typing for a longer time as compared with my webapp.
Any idea why that happens?
Code being used-
await stepContext.context.sendActivity({
type: 'typing'
});
Screenshot attached for reference.(The bot keeps typing even after intended reply has been received which doesnt happen in the case of webapp)
I'm using the Microsoft bot-framework to create a bot and integrate it into teams.
Part of the bot's requirements include proactively messaging users once per day. From what I understand, I can only message users that has been added to the team/groupChat after the bot, or that have messaged the bot directly.
My question is - can I somehow bypass this limitation?
A friend of my referred me to a new feature of graphAPI, as part of the new beta version - https://learn.microsoft.com/en-us/graph/api/user-add-teamsappinstallation?view=graph-rest-beta&tabs=http.
To me it doesn't seem like it could be related to the solution since I'm not getting any data back in the response, so if I have no conversationReference object I still can't message the user.
At the moment my solution is to simply broadcast a message in the channel when it's added, asking users to "register" with it by messaging it. Anyone has any other suggestion?
The easiest way is to:
Install the bot for the team
Query the Team Roster -- The link in Step 3 has an alternative way to do this towards the bottom
Create a conversation with the user and send a proactive message
There's a lot of code in those links and it's better to just visit them than to copy/paste it here.
The end of Step 3 also mentions trustServiceUrl, which you may find handy if you run into permissions/auth issues when trying to send a proactive message.
Edit for Node:
Install Necessary Packages
npm i -S npm install botbuilder-teams#4.0.0-beta1 botframework-connector
Note: The #<version> is important!
Prepare the Adapter
In index.js
const teams = require('botbuilder-teams');
adapter.use(new teams.TeamsMiddleware());
Get the Roster
// Get Team Roster
const credentials = new MicrosoftAppCredentials(process.env.MicrosoftAppId, process.env.MicrosoftAppPassword);
const connector = new ConnectorClient(credentials, { baseUri: context.activity.serviceUrl });
const roster = await connector.conversations.getConversationMembers(context.activity.conversation.id);
Send the Proactive Message
const { TeamsContext } = require('botbuilder-teams');
// Send Proactive Message
const teamsCtx = TeamsContext.from(context);
const parameters = {
members: [
roster[0] // Replace with appropriate user
],
channelData: {
tenant: {
id: teamsCtx.tenant.id
}
}
};
const conversationResource = await connector.conversations.createConversation(parameters);
const message = MessageFactory.text('This is a proactive message');
await connector.conversations.sendToConversation(conversationResource.id, message);
Trust the ServiceUrl, as Necessary
Read about it. You'd want this before the message is sent.
MicrosoftAppCredentials.trustServiceUrl(context.activity.serviceUrl);
EDIT: The Graph API you've referenced is only necessary if you wish to proactively message a user who is not in a channel/groupChat where the bot is installed. If you need to proactively message only people who are in context where the bot is installed already, the answer from mdrichardson is the easiest possible method.
We've identified a couple of issues with the Graph API beta endpoint you referenced that should be fixed in the near term. In the meantime workarounds are as follows:
Calling:
POST https://graph.microsoft.com/beta/me/teamwork/installedApps/
{"teamsapp#odata.bind":"https://graph.microsoft.com/beta/appcatalogs/teamsapps/APP-GUID"}
Will install an app in the personal scope of a user.
Known issue: Currently, if the app contains a bot, then installation will not lead to creation of thread between the bot and the user. However to ensure that any missing chat threads, get created, call:
GET https://graph.microsoft.com/beta/me/chats?$filter=installedApps/any(x:x/teamsApp/id eq 'APP-GUID')
Calling:
GET https://graph.microsoft.com/beta/me/chats?$filter=installedApps/any(x:x/teamsApp/id eq 'APP-GUID')
Gets the chat between a user and an app containing a bot.
Known issue: Calling this API will lead to sending a conversation update event to the bot even though there were no updates to the conversation. Your bot will essentially get two install events and you'll need to make sure you don't send the welcome message twice.
We'll also be adding more detailed documentation for the proactive messaging flow using these Graph APIs
I have created many bots with MS Bot Framework and they worked correctly, following the instructions of the proper channel (in https://dev.botframework.com/ -> Add another channel -> Add).
They all, including Slack, worked properly, but now app creation in Slack (https://api.slack.com/applications/new) is different to the instructions, and the bot is not working anymore (neither the old ones nor the new ones).
After submitting the credentials in https://dev.botframework.com/to add the Slack channel, everything appears to be ok, but in Slack the bot is always off-line, and the messages don't get botframework neither the messaging endpoint after that.
The only message I get in my messaging endpoint is:
{ type: 'installationUpdate',
action: 'add',
sourceEvent:
{ SlackMessage:
{ type: 'bot_added',
After adding the bot, but nothing after that. Any hints?
After some hours not working, the messages started to come again (it was a Microsoft or Slack problem)
I've been trying to add a bot to my Telegram group in Android Device but I am not able to do so. I tried #bot_name, /bot_name, but it doesn't work.
Is it possible to add a bot to the group or should I create a new bot using Telegram API (not bot API) so that I can add the contact number to the group?
Edit: now there is yet an easier way to do this - when creating your group, just mention the full bot name (eg. #UniversalAgent1Bot) and it will list it as you type. Then you can just tap on it to add it.
Old answer:
Create a new group from the menu. Don't add any bots yet
Find the bot (for instance you can go to Contacts and search for it)
Tap to open
Tap the bot name on the top bar. Your page becomes like this:
Now, tap the triple ... and you will get the Add to Group button:
Now select your group and add the bot - and confirm the addition
You have to use #BotFather, send it command: /setjoingroups
There will be dialog like this:
YOU: /setjoingroups
BotFather: Choose a bot to change group membership
settings.
YOU: #YourBot
BotFather: 'Enable' - bot can be added to groups. 'Disable' - block
group invitations, the bot can't be added to groups. Current status
is: DISABLED
YOU: Enable
BotFather: Success! The new status is: ENABLED.
After this you will see button "Add to Group" in your bot's profile.
Another way :
change BOT_USER_NAME before use
https://telegram.me/BOT_USER_NAME?startgroup=true
In my case the 2 steps worked:
Added bot to a group as a regular member
Made Bot an admin.
The second step was needed to let Bot respond and sent messages to Group chat.
The response event.postData.contents looked like this:
{
"ok":true,
"result":{
"message_id":31,
"from":{
"id":1234567890,
"is_bot":true,
"first_name":"bot for custom alerts",
"username":"mybotname1_bot"
},
"chat":{
"id":-1234567890,
"title":"group name",
"type":"group",
"all_members_are_administrators":true
},
"date":1624860599,
"text":"hi"
}
}
I needed to receive the chat id (negative number from response) to send messages to the group by Bot.