I am using the Bot Framework Rest API with Node. I am successfully sending reply messages upon a user sending a message (in MS Teams).
I am now trying to start a conversation, to which the response comes back successful, with a conversation id.
( POST /v3/conversations returns me an id - great!)
Then, I try to send a message to that conversation id and I keep getting Service error 'Unknown'. I have tried everything..
Get token function (works fine)
Create a conversation (works fine)
Using the conversationId above, send a message (Not working):
I am following the documentation provided:
https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference?view=azure-bot-service-4.0#create-conversation
Step 1, create a conversation:
Step 2, send message using conversation id from above:
I see nobody is posting so in case someone finds this and wants more detail, here is an on-going conversation about it - https://github.com/microsoft/BotFramework-Services/issues/260
Related
I would like to send messages to users through Slackbot, just like integration apps such as Zapier.
If I set the channel ID to the user ID it sends a 1:1 message showing up in the Apps tab, but what I really would like to do is to send a message in Slackbot, as I want to create a seamless experience for a Workflow I'm creating.
Then, if I try adding the Slackbot channel ID it returns channel_not_found and there's no way to add the App there.
My current bot token scope to send messages is: chat:write and I'm sending a message using chat.postMessage
Do I need a different scope? Different API method? I've tried going through some other questions/answers, but they look outdated
After downloading and running the sample project (Meeting Token Generator) I tried to create my own bot. So I followed the steps 2 and 3 (in the previous link) to create a new resource and a new bot channel registration. After this I replicated the method PostStatusChangeNotification (from visual studio project), that should sends a bubble, into a java function, on a springboot project.
So I used continueConversation method from BotFrameworkHttpAdapter to send the bubble.
There are these two problems:
As the docs (of method continueConversation): Most channels require a user to initiate a conversation with a bot before the bot can send activities to the user. So, how meeting token generator can send activities into a meeting chat without user conversation init?
Why bubble not showing when my bot send the activity? Only chat message works. I also tried to manually post (with postman) the same JSON payload generated by Meeting Token Generator (modifying the data to be modified), and I noticed that the bubble is shown only using Meeting Token Generator's bot.
So the same post request with a different bot's bearer token doesn't show the bubble, but only in-chat message. I really can’t explain it.
Hope you can help me, thanks.
I have tried to send MS Teams bot message request via rest api:
End point: https://smba.trafficmanager.net/ca/apis/v3/conversations/{conversation id}/activities
{"text":"test","type":"message"}
And got empty response:
{}
The message i sent did not appear in the conversation.
Any idea where i could have misconfigured?
It is possible that trustServiceUrl needs to be run before a message is sent, i can't find equivalent rest api to call.
You definitely do need call trustServiceUrl before sending the message. In addition, you need to have additional properties on your activity, like the destination user or tenant id. Please refer to the documents on this, and good starting places are here and here.
I am using Bot Framework SDK for Javascript. My bot is connected to the Teams channel. Right now I am saving every outgoing and incoming message from my bot to the DB.
But I want also to save reactions of user to my messages. That is why I am using TeamsActivityHandler and onReactionsAdded method (link). In the docs there is written that replyToId field of turnContext is the id of message user is reacting to.
But when I am sending message to the user via turnContext.sendActivity() I don't know the internal id which will be given to this message on Teams side, that is why I can not pair reaction to the message stored in my db.
So my question is, How can I get the id of the message after sending it via turnContext.sendActivity() which will be later send in replyToId field to onReactionsAdded handler?
In other words I want to collect feedback (via reactions) on the messages my bot is sending to the user and save them to my DB (messages and reactions).
Actually it turns out (after some tries) that turnContext.sendActivity() returns ResourceIdentifier which contains one field id and that id is the id which will be given to the message on the Teams side.
EDIT:
For some ResourceIdentifier is empty when message sent to Teams is for example hero card. So this does not completly work.
You can access the activity param after the await command to get this ID. So if we have our response in a variable reply (could be text, hero card etc...) we can get the ID after the await (inside the override async Task OnMessageActivityAsync method)
await turnContext.SendActivityAsync(reply, cancellationToken);
string responseMsgId = reply.Id;
Based on a GitHub sample, I created a dialog bot in Teams that collects information from a user and sends that to a Flow (Microsoft Flow/Power Automate) with a HTTP POST call.
After that the Bot waits for a response and sends it back to the user. This generally would be sufficient if the timeout for the call wasn't limited to 2 minutes - sometimes it takes longer to get the complete actions in Flow and get the response.
My question is how I could accomplish the same without getting the timeout. REST seemed the easiest as I'm not a programmer..
I checked the GitHub sample for proactive messaging (https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/16.proactive-messages), and that worked in the Emulator when I enter http://localhost:3978/api/notify, but I have no idea how to use it published to Azure. What would be the endpoint and how I could pass the message text?
Thanks
You should do some code modify if you want to send an message based on proactive-messages demo .
You can refer to my previous post which will meet your requirement.
After you modify the NotifyController.cs file , you can use send messages to a specific user with steps below :
Connect to your bot get current user ID :
Send message to this user by rest client tool or post man :
Result :
If you publish your bot to Azure , lets assume your Azure App service host is :https://xxxxxx.azurewebsites.net , then your bot message endpoint will be :https://xxxxxx.azurewebsites.net/api/messages and your /notify function endpoint will be : https://xxxxxx.azurewebsites.net/api/notify . In brief , just use your Azure App service endpoint to replace http://localhost:3978 will be fine .
Hope it helps . If there is anything unclear pls feel free to let me know .