poshbotio / PoshBot

Powershell-based bot framework
MIT License
539 stars 108 forks source link

Bot crashes when sending command - TEAMS #102

Closed delrio1110 closed 6 years ago

delrio1110 commented 6 years ago

Powershell version 6.0.4 This is what I get when I Type !help in teams or any other bot function. Please help. Im also documenting the start to finish setup process and I can I give it to you so that anyone having issues or if they arent familiar with Azure can follow.

WARNING: {"DataTime":"2018-09-02 20:18:24Z","Class":"TeamsBackend","Method":"UsernameToUserId","Severity":"Warning","LogLevel":"Debug","Message":"User [REMOVED] not found. Refreshing users","Data":{}} {"DataTime":"2018-09-02 20:18:25Z","Class":"Bot","Method":"Start","Severity":"Error","LogLevel":"Info","Message":"Response status code does not indicate success: 404 (Not Found).","Data":{"CommandName":"Invoke-RestMethod","Message":"Response status code does not indicate success: 404 (Not Found).","TargetObject":{"Version":{"Major":1,"Minor":1,"Build":-1,"Revision":-1,"MajorRevision":-1,"MinorRevision":-1},"Content":null,"Method":{"Method":"GET"},"RequestUri":"https://smba.trafficmanager.net/amer/v3/conversations/19:610903d4fe9be5655a/members/","Headers":[{"Key":"Authorization","Value":["Bearer _do4IDIJBjKpo4y8IQNvcX REMOVED hozJK_PfIjKYeTR7XoACZrfgqak3ylgzHJuUAUBXA"]},{"Key":"User-Agent","Value":["Mozilla/5.0","(Windows NT 10.0; Microsoft Windows 10.0.17134; en-US)","PowerShell/6.0.4"]}],"Properties":{}},"Position":"At C:\Users\delri\Documents\WindowsPowerShell\Modules\PoshBot-master\out\PoshBot\0.11.0\PoshBot.psm1:7877 char:24\n+ $members = Invoke-RestMethod -Uri $uri -Headers $headers\r\n+ ~~~~~~~~~","CategoryInfo":"InvalidOperation: (Method: GET, Re...rShell/6.0.4\r\n}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException","FullyQualifiedErrorId":"WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand"}} At line:1 char:1

devblackops commented 6 years ago

@delrio1110 When you define your bot admins in your config, make sure you're using the UPN. I don't think it's able to resolve your username to an ID.

delrio1110 commented 6 years ago

Ill try that and report back

delrio1110 commented 6 years ago

@devblackops

So, I double checked the AAD UPN and it is correct. I also started from scratch and followed your new documentation but im getting the same error when I send a command like "!help" to the bot. below are the errors im getting. Great documentation on the teams part.

delrio1110 commented 6 years ago

@devblackops

WARNING: {"DataTime":"2018-09-08 08:12:18Z","Class":"StorageProvider","Method":"GetConfig","Severity":"Warning","LogLevel":"Info","Message":"Configuration file [C:\Users\delri\.poshbot\plugins.psd1] not found","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:18Z","Class":"StorageProvider","Method":"GetConfig","Severity":"Warning","LogLevel":"Info","Message":"Configuration file [C:\Users\delri\.poshbot\plugins.psd1] not found","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:18Z","Class":"PluginManager","Method":"GetPluginConfig","Severity":"Warning","LogLevel":"Debug","Message":"No plugin configuration defined in storage","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:18Z","Class":"RoleManager","Method":"AddPermission","Severity":"Warning","LogLevel":"Info","Message":"Permission [manage-permissions] is already loaded","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:18Z","Class":"RoleManager","Method":"AddPermission","Severity":"Warning","LogLevel":"Info","Message":"Permission [manage-schedules] is already loaded","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:18Z","Class":"RoleManager","Method":"AddPermission","Severity":"Warning","LogLevel":"Info","Message":"Permission [manage-plugins] is already loaded","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:18Z","Class":"RoleManager","Method":"AddPermission","Severity":"Warning","LogLevel":"Info","Message":"Permission [view-role] is already loaded","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:18Z","Class":"RoleManager","Method":"AddPermission","Severity":"Warning","LogLevel":"Info","Message":"Permission [view] is already loaded","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:18Z","Class":"RoleManager","Method":"AddPermission","Severity":"Warning","LogLevel":"Info","Message":"Permission [view-group] is already loaded","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:18Z","Class":"RoleManager","Method":"AddPermission","Severity":"Warning","LogLevel":"Info","Message":"Permission [manage-groups] is already loaded","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:18Z","Class":"RoleManager","Method":"AddPermission","Severity":"Warning","LogLevel":"Info","Message":"Permission [show-help] is already loaded","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:18Z","Class":"RoleManager","Method":"AddPermission","Severity":"Warning","LogLevel":"Info","Message":"Permission [manage-roles] is already loaded","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:19Z","Class":"StorageProvider","Method":"GetConfig","Severity":"Warning","LogLevel":"Info","Message":"Configuration file [C:\Users\delri\.poshbot\schedules.psd1] not found","Data":{}} WARNING: {"DataTime":"2018-09-08 08:12:33Z","Class":"TeamsBackend","Method":"UsernameToUserId","Severity":"Warning","LogLevel":"Debug","Message":"User [dhernandez@REMOVEDrgy.com] not found. Refreshing users","Data":{}}

{"DataTime":"2018-09-08 08:12:34Z","Class":"Bot","Method":"Start","Severity":"Error","LogLevel":"Info","Message":"Response status code does not indicate success: 403 (Forbidden).","Data":{"CommandName":"Invoke-RestMethod","Message":"Response status code does not indicate success: 403 (Forbidden).","TargetObject":{"Version":{"Major":1,"Minor":1,"Build":-1,"Revision":-1,"MajorRevision":-1,"MinorRevision":-1},"Content":null,"Method":{"Method":"GET"},"RequestUri":"https://smba.trafficmanager.net/amer/v3/conversations/19:a7REMOVED2d@thread.skype/members/","Headers":[{"Key":"Authorization","Value":["Bearer eyJ0eXAiOiJKV1QiLCJhbGceyJhdWQiREMOVEDKcKg"]},{"Key":"User-Agent","Value":["Mozilla/5.0","(Windows NT 10.0; Microsoft Windows 10.0.17134; en-US)","PowerShell/6.0.4"]}],"Properties":{}},"Position":"At C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PoshBot\0.11.0\PoshBot.psm1:7875 char:24\n+ $members = Invoke-RestMethod -Uri $uri -Headers $headers\r\n+ ~~~~~~~~~","CategoryInfo":"InvalidOperation: (Method: GET, Re...rShell/6.0.4\r\n}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException","FullyQualifiedErrorId":"WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand"}} At line:1 char:1

delrio1110 commented 6 years ago

I rebooted and now its working.