05-26-2022 11:50 AM
I am trying to build a script that will send a message to a WebEx room when an event happens.
I registered a OAUTH integration app, but the key expires when I use it after a bit (which is expected).
Currently, I have to manually paste the OAuth authorization URL into the browser and click 'accept' in order to get the 'code' URL parameter that the script needs. Is there a way I can automate this? I can't manually perform this step every few hours.
I am trying to use the webexteamssdk, but all the documentation talks about using the personal access token which is not supposed to be used in production.
Example of Code
from webexteamssdk import WebexTeamsAPI api = WebexTeamsAPI( client_id="xxxxxxxxxxxxxxxxxxxxxxxx", client_secret="xxxxxxxxxxxxxxxxxxxxxxxx", oauth_code="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", redirect_uri="http://localhost", ) api.messages.create( "xxxxxxxxxxxxxxxxxxxxxxxxxx", text="This is My Message", )
This code works, but I have to keep manually generating the 'oauth_code'. Is there a way to automate this with the SDK?
Am I even thinking about this the right way? OAuth is kinda new to me.
Thanks!
Solved! Go to Solution.
05-26-2022 05:08 PM
So my solution to this was to use a bot token, not OAuth. OAuth is apparently designed to have user interaction and bots are not.
05-26-2022 05:08 PM
So my solution to this was to use a bot token, not OAuth. OAuth is apparently designed to have user interaction and bots are not.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide