Jump to content
rcmaehl

Cisco Finesse UDF

Recommended Posts

rcmaehl
Posted (edited)

Hi all, 

Recently my work swapped from Cisco CTIOS to Finesse. This completely threw me off as I had been automating the Win32 application and I had never done IUIAutomation before. As such I've been messing around with the API and will be adding code as I figure it out. While I do have Supervisor access, I will likely not be adding functions for those features yet.

Currently Available Functions:

User API - Query and Set User Info

Spoiler

_FinesseGetCalls($sAPI, $sUser, $sPassword)

  • Gets a list of Calls and other Dialog for a User

_FinesseGetReason($sAPI, $iID, $sUser, $sPassword)

  • Gets a specific reason assigned to an ID

_FinesseGetReasonList($sAPI, $sState, $sUser, $sPassword)

  • Gets available reasons for States that require it

_FinesseGetState($sAPI, $sUser, $sPassword)

  • Gets Agent State

_FinesseGetUser($sAPI, $sUser, $sPassword)

  • Gets Agent Information

_FinesseGetUsers($sAPI, $sUser, $sPassword)

  • Gets a list of all users

_FinesseGetWrapUpReason($sAPI, $iID, $sUser, $sPassword)

  • Gets a specific WrapUp reason assigned to an ID

_FinesseGetWrapUpReasonList($sAPI, $sUser, $sPassword)

  • Gets available reasons for WrapUp that require it

_FinesseLogin($sAPI, $sUser, $sPassword, $iExtension)

  • Logs agent in with LOGIN status at the requested Extension
  • Works but won't sign you into the Web App

_FinesseLogout($sAPI, $sUser, $sPassword)

  • Signs agent out with LOGOUT state

_FinesseMobileLogin($sAPI, $sUser, $sPassword, $iExtension, $sMode, $iForward)

  • Logs agent in with LOGIN status at the requested Extension
  • Redirects calls to Listed Mobile Number
  • Works but won't sign you into the Web App

_FinesseSetState($sAPI, $sState, $sReason, $sUser, $sPassword)

  • Sets Agent State
  • Leave $sReason blank for states not requiring it

Dialog API - Query and Set Call and other Dialog Info

Spoiler

_FinesseGetCall($sAPI, $iID, $sUser, $sPassword)

  • Gets Call or other Dialog Details

_FinesseMakeCall($sAPI, $iFrom, $iTo, $sUser, $sPassword)

  • Places a call through your Soft or Hard Phone
  • Phone may be required to be off hook depending on model
  • Call Variables support planned

Queue API - Query Assigned Queues

Spoiler

_FinesseGetQueue($sAPI, $iID, $sUser, $sPassword)

  • Gets a Specific Queue

_FinesseGetUserQueues($sAPI, $sUser, $sPassword)

  • Gets Queues assigned to a Specific User

Team API - Query Users in a Team

Spoiler

_FinesseGetTeam($sAPI, $iID, $sUser, $sPassword)

  • Gets Users and User info in a specific team



Changelog:

Spoiler

7/11/18

  • Corrected Finesse misspelling in FinesseGetCall, FinesseMakeCall, FinesseGetQueue, FinesseGetUserQueues, and FinesseGetTeam
    SCRIPT BREAKING! Resolution: Replace All Fineese with Finesse


6/25/18

  • Corrected Header for _FinesseGetCall
  • Added Team API including FinesseGetTeam
  • Added Queue APIs including FinesseGetQueue, FinesseGetUserQueues

6/22/18 Ver 2

  • Corrected Include Variable Conflict
  • Corrected Link in _FinesseGetReason
  • Corrected Extra Data in _FinesseGetCall
  • Corrected HTTP  Method in _FinesseGetCall
  • Corrected API URL in _FinesseGetWrapUpReason

6/22/18

  • Updated All Headers to be even more detailed
  • Functions are now Separated per API in the docs
  • Added _FinesseGetCall - Gets call details, returned in XML currently
  • Added _FinesseGetReason - Gets Reason assigned to an ID
  • Added _FinesseGetUsers - Gets a list of All Users
  • Added _FinesseGetWrapUpReason - Gets a specific WrapUp reason assigned to an ID
  • Added _FinesseGetWrapUpReasonList - Gets available reasons for WrapUp that require it

6/21/18

  • Added _FinesseLogout
  • Corrected issue with Mobile Agent Login
  • Corrected issue with Setting State returning error incorrectly

6/20/18 10:00 EST

  • Added _FinesseMobileLogin
  • Updated all Function headers to be accurate and detailed
  • Moved Download to Downloads Section

6/19/18 08:00 EST

  • Minor fix to _FinesseGetUser header
  • Added _FinesseGetReasonList, currently returns XML

6/18/18 08:00 EST

  • Added _FinesseGetUser, currently returns XML
  • Added _FinesseMakeCall, call variable support to be added

6/15/18 08:00 EST

  • Added Missing <String.au3> requirement
  • Added _FinesseLogin() - NOTE: Won't sign you into the Web App, just Finesse
  • Functions now return True on success unless otherwise stated

6/14/18 11:30 EST

  • Initial Release

 

Download:

 

Edited by rcmaehl
Update 7/11

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
mLipok
Posted (edited)

I will keep an eye on this project.
In the meantime, could you provide a link to  Finesse reference documentation ?

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library
 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-10-31

Share this post


Link to post
Share on other sites
rcmaehl
35 minutes ago, mLipok said:

I will keep an eye on this project.
In the meantime, could you provide a link to  Finesse reference documentation ?

Here's what I'm using

https://solutionpartner.cisco.com/media/finesseDevGuide2/


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
rcmaehl
Posted (edited)

Updated:

  • Added Missing <String.au3> requirement
  • Added _FinesseLogin() - NOTE: Won't sign you into the Web App, just Finesse
  • Functions now return True on success unless otherwise stated because Finesse doesn't return anything other than HTTP 202
Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
rcmaehl

Updated:

  • Added _FinesseGetUser, currently returns XML
  • Added _FinesseMakeCall, call variable support to be added

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
rcmaehl
Posted (edited)

Updated:

  • Minor fix to _FinesseGetUser header
  • Added _FinesseGetReasonList, currently returns XML


@mLipok Since you're following, anything you'd like to me prioritize adding? Currently, I've only added stuff I've needed in my own scripts.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
mLipok
Posted (edited)

I do not have access to CISCO, but the project is interesting.

I think soon I will be happy :) do add your UDF to WIKI page ...

btw.
You should add some internal COM Error Handler.

EDIT:
I know that your UDF is currently small and it's just getting better, but if you will be ready you should post this code here:

https://www.autoitscript.com/forum/files/category/19-social-media-and-other-website-api/

As this is a good place for users to search updates for UDF's.

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library
 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-10-31

Share this post


Link to post
Share on other sites
rcmaehl

Updated:

  • Added _FinesseMobileLogin
  • Updated all Function headers to be accurate and detailed
  • Moved Download to Downloads Section

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
mLipok
Posted (edited)

super fine.

but I do not think that "Databases and web connections" is correct place for this UDF , for this I sugested other group.

This should be consistent with Wiki
https://www.autoitscript.com/wiki/User_Defined_Functions#Databases_and_web_connections

And when I look there then I see one "releated" UDF in:
https://www.autoitscript.com/wiki/User_Defined_Functions#Hardware

I thought about: _FB_Tools - manage your FritzBox from Autoit

But maybe you have right, could you explain your choice ?

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library
 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-10-31

Share this post


Link to post
Share on other sites
rcmaehl
Posted (edited)
34 minutes ago, mLipok said:

But maybe you have right, could you explain your choice ?

I had based my choice on what was currently in the Downloads page under the existing categories: https://www.autoitscript.com/forum/files/categories/

I feel like this might fit under IT Administration since it's mainly something HelpDesks/ServiceDesks will be using, however I didn't see an appropriate sub category.

The category of Social Media and other Website API felt like more like publicly accessible pages and API in which anyone could access from anywhere compared to a local server that shouldn't have the Cisco API available to the public, only authenticated users.

Internet protocol suite might have worked but was mainly used for big Protocols so far (UDF, TCP, POP, IRC)

I chose Databases and web connections, for the web connections part. Databases generally aren't directly publicly accessible which Finesse also follows as it should only be accessible within a local network. I'll take a look at the Wiki and see if there's a better grouping based on what's on the Wiki. 

Hardware definitely feels like a better fit than Social Media and other website API though

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
rcmaehl
Posted (edited)

Updated:

  • Added _FinesseLogout
  • Corrected issue with Mobile Agent Login
  • Corrected issue with Setting State returning error incorrectly
  • Download is now located in the Hardware section of Downloads
Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
rcmaehl

6/22/18

  • Updated All Headers to be even more detailed
  • Functions are now Separated per API in the docs
  • Added _FinesseGetCall - Gets call details, returned in XML currently
  • Added _FinesseGetReason - Gets Reason assigned to an ID
  • Added _FinesseGetUsers - Gets a list of All Users
  • Added _FinesseGetWrapUpReason - Gets a specific WrapUp reason assigned to an ID
  • Added _FinesseGetWrapUpReasonList - Gets available reasons for WrapUp that require it

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
rcmaehl

6/25/18

  • Corrected Header for _FinesseGetCall
  • Added Team API including FinesseGetTeam
  • Added Queue APIs including FinesseGetQueue, FinesseGetUserQueues

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
rcmaehl

7/11/18

  • Corrected Finesse misspelling in FinesseGetCall, FinesseMakeCall, FinesseGetQueue, FinesseGetUserQueues, and FinesseGetTeam
    SCRIPT BREAKING! Resolution: Replace All Fineese with Finesse

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • rcmaehl
      By rcmaehl
      A UDF to connect and control Cisco Finesse on the Local Network via it's provided HTTP API
       
      Current Features:
      Heavyweight
      * Large feature set, containing most Finesse Desktop API functions  
      PLANNED Features:
      Heavyweight
      * Control over own Status as well as Supervisor functionality
        Helpful Premade Examples Files
      * Examples for almost every function
      * Premade CUI and GUI clients showing 
        Ready for all users, beginner and up
      * Detailed Error Reporting to help pin-point problems
      * Thorough parameter checking to prevent accidental script crashes
    • Iznogoud
      By Iznogoud
      Hi,
      I was wondering if someone can help me to create an AutoIT script which can create a ticket in a TopDesk environment.
      The API is wel documented, but i have not enough knowlegde at this moment to get this up from the ground. If someone could help me or if i could hire / pay someone to help me with this, that would be great.
      Information about the API can be found here: https://developers.topdesk.com/
      Is there a place where i maybe can hire AutoIT professionals to help me with this?
      On freelancer.com is an option, but there are alot of people responding which doesn't know a thing about AutoIT.
    • Ascer
      By Ascer
      1. Description.
      oAuth 2.0 is security system implemented by Google a few years ago. You are able to connect into your Google accounts and manage documents. In this UDF i show you how to pass first authorization process., this allow you to automate most of functions using API interface. 2. Requirements.
      Google account. oAuth.au3 Download 3. Possibilities
      ;============================================================================================================ ; Date: 2018-02-10, 14:21 ; ; Description: UDF for authorize your app with oAuth 2.0 Google. ; ; Function(s): ; oAuth2GetAuthorizationCode() -> Get Code for "grant". ; oAuth2GetAccessToken() -> Get "access_token" and "refresh_token" first time. ; oAuth2RefreshAccessToken() -> Get current "access_token" using "refresh_token". ; ; Author(s): Ascer ;============================================================================================================ 4. Enable your Google API.
          4.1. Video Tutorial not mine!
       YouTube     4.2 Screenshots from authorization process (Polish language) 
      Go to https://console.developers.google.com/apis/dashboard and accept current rules.  

       
      Next create an new project  

       
      Enter name of you new project and click Create  

       
      Google will working now, please wait until finish. Next go to enable your API interface, we make if for Google  

       
      Take "Gmail" in search input and after click in found result.  

       
      Click Enable interface, Google will working now.  

       
      Create your login credentials  

       
      Select Windows Interface (combobox), User credentials (radio) and click button what is need bla bla  

       
      Type name of a new client id for oAuth 2.0 and click Create a new Client ID.  

       
      Next configure screen aplication, type some name and click Next. Google will working now.  

       
      Last step on this website is download source with your credentials in *Json format.  

       
      Now you received a file named client_id.json, it's how it look in Sublime Text:  

       
      5. Coding.
      Now we need to call a some function to get access code.  
      #include <oAuth.au3> Local $sClientId = "167204758184-vpeues0uk6b0g4jrnv0ipq5fapoig2v8.apps.googleusercontent.com" Local $sRedirectUri = "http://localhost" oAuth2GetAuthorizationCode($sClientId, $sRedirectUri)  
      Function will execute default browser for ask you to permission.  

       
      Next Google ask you to permission for access to your personal details by application Autoit   

       
      Now you can thing is something wrong but all is ok, you need to copy all after  code= . It your access code.  

       
      Let's now ask Google about our Access Token and Refresh Token  
      #include <oAuth.au3> Local $sClientId = "167204758184-vpeues0uk6b0g4jrnv0ipq5fapoig2v8.apps.googleusercontent.com" Local $sClientSecret = "cWalvFr3WxiE6cjUkdmKEPo8" Local $sAuthorizationCode = "4/AAAPXJOZ-Tz0s6mrx7JbV6nthXSfcxaszFh_aH0azVqHkSHkfiwE8uamcabn4eMbEWg1eAuUw7AU0PQ0XeWUFRo#" Local $sRedirectUri = "http://localhost" Local $aRet = oAuth2GetAccessToken($sClientId, $sClientSecret, $sAuthorizationCode, $sRedirectUri) If Ubound($aRet) <> 4 then ConsoleWrite("+++ Something wrong with reading ResponseText." & @CRLF) Exit EndIf ConsoleWrite("Successfully received data from Google." & @CRLF) ConsoleWrite("access_token: " & $aRet[0] & @CRLF) ConsoleWrite("expires_in: " & $aRet[1] & @CRLF) ConsoleWrite("refresh_token: " & $aRet[2] & @CRLF) ConsoleWrite("token_type: " & $aRet[3] & @CRLF)  
      Important! When you received error 400 and output says: Invalid grant it means that your previous generated access_code lost validity and you need to generate new calling previus code. When everything is fine you should received a 4 informations about your: access_token, expires_in, refresh_token and token_type. Access_Token time is a little short so you need to know fuction possible to refresh it (tell Google that he should generate a new Token for you)  
      #include <oAuth.au3> Local $sRefreshToken = "1/ba8JpW7TjQH3-UI1BvPaXhSf-oTQ4BmZAbBfhcKgKfY" Local $sClientId = "167204758184-vpeues0uk6b0g4jrnv0ipq5fapoig2v8.apps.googleusercontent.com" Local $sClientSecret = "cWalvFr3WxiE6cjUkdmKEPo8" Local $sRedirectUri = "http://localhost" Local $aRet = oAuth2RefreshAccessToken($sRefreshToken, $sClientId, $sClientSecret) If Ubound($aRet) <> 3 then ConsoleWrite("+++ Something wrong with reading ResponseText." & @CRLF) Exit EndIf ConsoleWrite("Successfully received data from Google." & @CRLF) ConsoleWrite("access_token: " & $aRet[0] & @CRLF) ConsoleWrite("expires_in: " & $aRet[1] & @CRLF) ConsoleWrite("token_type: " & $aRet[2] & @CRLF)  
      6. Finish words
      If you followed all this above steps im sure that you received all informations required for coding your Google API (Gmail, Dropbox, YouTube, Calender etc. See next thread: [UDF] Gmail API - Email automation with AutoIt!
    • Ascer
      By Ascer
      1. Description.
      Automate communication with Gmail API using oAuth 2.0 security. 2. Requirements.
      Google Gmail account. Finished Authorization process. Look here 3. Possibilities.
      ;======================================================================================================================== ; Date: 2018-02-12, 11:46 ; ; Bug Fixs: 2018-02-17, 7:31 -> Fixed problems with adding items to array and minor bugs. ; ; Description: UDF for using Gmail API interface. This UDF requires oAuth.au3 and Gmail account. ; ; Function(s): ; gmailUsersGetProfile() -> Information about your account. ; gmailUsersLabelsList() -> Get all available labels ids. ex. "INBOX", "UNREAD" ; gmailUsersLabelsGet() -> Get information about specific label id. ; gmailUsersMessagesBatchDelete() -> Delete many messages emails by id. ; gmailUsersMessagesBatchModify() -> Set status for many messages ex. "INBOX", "UNREAD" ; gmailUsersMessagesDelete() -> Totaly delete email from ur account. ; gmailUsersMessagesGet() -> Get all information about specific email. ; gmailUsersMessagesList() -> Get list of last ~100 emails. ; gmailUsersMessagesModify() -> Modify single message. ; gmailUsersMessagesTrash() -> Put email in trash. ; gmailUsersMessagesUntrash() -> Restore email from trash. ; gmailUsersMessagesSend() -> Send email to single or group recipients. ; gmailUsersMessagesAttachmentsGet() -> Download attachment by id. ; ; Author(s): Ascer ;======================================================================================================================== 4. Downloads.
      oAuth.au3 Gmail API.au3 5. Examples.
      Sending emails
×