0
votes

I'm trying to send a private message to a user on teams.

I've checked several resources, but still have problems.

Using this sampel https://github.com/OfficeDev/msteams-samples-proactive-messaging I've tried the following.

  1. ngrok http -host-header=rewrite 5000

  2. Upload manifest.zip to teams

  3. Update coordinate-logger/appsettings

  4. Run coordinate-logger

  5. dotnet run -- sendUserMessage --app-id="{{Bot Id}}" --app-password="{{Bot Password}}" --service-url="{{ServiceUrl}}" --conversation-id="{{Conversation Id}}" --message="Send Message to a User"

Bot Id = appId

Bot Password = secret

service-url = ngrok host ( ngrok http://e4438bf4e8ed.ngrok.io )

conversation-id = my user's team guid

I'm getting 404 on http://e4438bf4e8ed.ngrok.io/v3/conversations/xxxxxxx-59c1-45d2-829d-069fefda33bf/activities

Am I missing something?

1

1 Answers

2
votes

The problem is your serviceUrl - it's not supposed to be a link to your OWN service - it's meant to be the unique ServiceUrl for the particular conversation in question. Teams has a few of these, based on where the tenant is located (e.g. "NAM" for North America"). You need to get the one specific for your conversation, in the same way that you get the conversationId. Without being familiar with this particular sample you're using, I'd guess that it's part of the 'coordinate-logger' project.

The ServiceUrl should look something like this: https://smba.trafficmanager.net/emea/ or https://smba.trafficmanager.net/nam/ or similar.

To explain why this is important, you might find it worthwhile to read a blog post I've got about how the calls work. It doesn't discuss proactive messaging per se, but it's relevant nonetheless. See https://hilton.giesenow.com/how-bot-calls-actually-work .

[update: adding some format examples] The conversation id looks a bit different based on the type of conversation (1-1, group chat, or Teams channel), but it should look similar to one of these:

  • 1-1 chat: a:1gUrQbVe1BjcpZePQ6m.......[long value]
  • group chat: 19:0a5b1b32cc54402[other bits]@thread.v2
  • channel: 19:ac23ff62cc54402[other bits]@thread.skype