meraki / spark-operations-bot

bot leveraging the Spark Bot framework
MIT License
13 stars 9 forks source link

Unable to get ORG URL #10

Closed bit-git closed 6 years ago

bit-git commented 6 years ago

Hi, I am getting unable to get org url. Check username and password .. meassge. The app is executing fine and the spark bot is able to send messages. Exception thrown is Response code [404] The URI requested is invalid. I guess this because of Dbmap={}. The Meraki Dashboard url is not retrieved.

I have tested with two different accounts. One has an ORG selection page and the other does not. Both return the same message, unable to get org url.

Can the org url not be retrieved via the API? Why use username and password?

Thanks for writing the app ..

joshand commented 6 years ago

Unfortunately, there is nothing in the API that provides an accurate way to construct the Org URL. This is (or is supposed to be, at least) an optional component of the bot, and only needed if you plan on cross-launching from Spark into Meraki Dashboard networks. If you don't care about this functionality, you should be able to blank the username and password to disable. Let me do some testing to make sure this is working as intended.

joshand commented 6 years ago

Just confirmed that blanking the username and password will disable the URL generation. Can you test this to verify that the bot works without that? If that works correctly, and you want the URL cross-launching, then I'm happy to help with that. Just want to make sure it's working as expected without that component.

bit-git commented 6 years ago

Thanks a lot for testing. Just to confirm, is Umbrella Integration step necessary?

I found that there were special characters at the end of the password and the variable was not set properly. I changed the password and tried again, this time Dbmap was populated and org url generated but /health and /check commands did not work. There were 404 errors.

I have tested without username and password, same 404 errors.

I haven't setup S3 and Umberalla integration.

joshand commented 6 years ago

Umbrella and Spark integration are optional. Can you post the full exception dump?

bit-git commented 6 years ago

$ python3 app.py umbrella_log_collector.py - Missing Environment Variable. S3_BUCKET S3_ACCESS_KEY_ID S3_SECRET_ACCESS_KEY meraki_dashboard_link_parser.py - Missing Environment Variable. MERAKI_HTTP_USERNAME MERAKI_HTTP_PASSWORD Spark Bot Email: @sparkbot.io Spark Token: REDACTED Found existing webhook. Updating it. Configuring Webhook. Webhook ID:

joshand commented 6 years ago

Thank you. What version of ciscosparkapi are you running? Is it the version from requirements, or did you install separately?

bit-git commented 6 years ago

I was using an older version. Sorry! I upgraded to 0.9.2 and getting 404 for message not found. If put the msgid here - [https://developer.ciscospark.com/endpoint-messages-messageId-get.html] the message is found.

I downgraded to 0.7.1 and still same 404 error.

-----------------------------------Response------------------------------------ 404 Not Found TrackingID: ROUTER_5ABA923F-DE82-01BB-03F9-521EA2CB03F9 Cache-Control: no-cache Content-Type: application/json Date: Tue, 27 Mar 2018 18:49:35 GMT Server: Redacted l5d-success-class: 1.0 Via: 1.1 linkerd content-encoding: gzip content-length: 141 Strict-Transport-Security: max-age=63072000; includeSubDomains; preload

{"message":"Unable to get message.","errors":[{"description":"Unable to get message."}],"trackingId":"ROUTER_5ABA923F-DE82-01BB-03F9-521EA2CB03F9"} 127.0.0.1 - - [27/Mar/2018 19:49:27] "POST / HTTP/1.1" 500 -

joshand commented 6 years ago

Ok, I think I figured it out. Are you using a bot account attached to your user account, or are you using a full account for the bot? My initial testing was all with a bot account, and I just tested with a full account, and I'm getting the same error: {"message":"Unable to get message.","errors":[{"description":"Unable to get message."}],"trackingId":"ROUTER_5ABAA37F-ED1B-01BB-03AC-806BF1BA03AC"} 127.0.0.1 - - [27/Mar/2018 13:03:39] "POST / HTTP/1.1" 500 -

Let me see what changes it will take to make it work with a full account... Hopefully won't be too big of a deal...

joshand commented 6 years ago

I should clarify, are you using the Token of a bot account, or the Token of a user account? Each will be different...

joshand commented 6 years ago

I tested with a full account and it worked. Double check to make sure the Token that you are providing to the bot is the correct one (the one that matches the username/email of your bot). I was able to duplicate this when using a bot account, but the token for my user account instead of the token for the bot account. The other thing that would cause this is if you start out using the bot with your personal token, and then create a bot account and try to switch the bot to that token, and then try to use the exact same room. You'll have to start a new room. Once you have confirmed that these match, please let me know if you are still having this problem.

bit-git commented 6 years ago

Thanks a lot for looking into this. I am using full account. I regenerate the bot access token and it worked and was able to find the message. But unfortunately, did not work as expected. When I issue the health command, there is KeyError: 'Q2HD-2KXX-SXGW' thrown. Q2HD-2KXX-SXGW is the serial number of one of the wireless access points. Please see below.

bit-git commented 6 years ago

i guess we should close this issue as it's not related to the original issue in the title.

joshand commented 6 years ago

I'm going to look at this - feel free to open it as a new bug for tracking.

bit-git commented 6 years ago

Hi, Thanks. I found out the reason for KeyError - the access point was in repeater mode and had no uplink info.

Now I am getting another traceback - I guess this is becasue i do not have phones in my network. I will submit an issue if you would like to have a look.