Zammad integration to 3CX - integration

I will like to integrate a Zammad installation to 3CX PBX.
I found how to do it on the 3CX documentation but, I didn't found a great suggestion.
Am open for more suggestion especially a great example.

This is what I tried and it worked for me. it's an implementation off zammad but more in the the 3CX softphone. We get the number from the incoming call or outgoing call from the 3CX softphone before it's received by the agent or customer.
I created a batch script to search the number picked from the 3CX softphone in Zammad, Making use of the search function in zammad since users and tickets will have this number recorded, the Agent will get a pop in the default web browser of the search results in Zammad.
To connect the batch script to 3CX navigate to 3CX settings > select Advanced Settings and then select > Behavior > Tick the Launch Application on incoming call and also select the path where the batch script is saved.
Below are the commands to be saved in the batch script that will be executed every time a call is made in 3CX and it will open up a default web browser
Kindy note that you can add-in more API calls in the batch script as you wish to complete your required workflow
::3CXURL_launcher ***takes number as param #echo OFF set
param=%1 set url1=https://zammad_domain_url/#search/ set
full=%url1%%param% #echo ON #start %full%

Related

How can I get Grafana to read a custom metric?

Currently my Grafana Dashboard reads system info from the Grafana agent that runs on my machine.
I have a script that executes hourly to do some action. If the script executes successfully then it can output that success to an XML file or create a file called "success.txt". If the script fails then it could create a file "fail.txt".
How can I get Grafana to check for the presence of a file or a file's content to get it to report back to the dashboard the status, basically a binary result, of a custom metric "Hourly script job" such as success or fail?
I've searched the web and found any-json-to-metrics exporter but not sure that'll work. I'd like to avoid hosting a web server that exposes endpoints. I'd like for the Grafana agent to pick up the custom metrics.

Is it possible to increase the limit for URL Fetch daily quota for the Apps Script API?

We have hundreds of users and we occasionally get blocked because we exceed the quota for UrlFetch. Is it possible to increase this limit? Or is there another workaround so we don't get throttled?
If I am not mistaken, it is possible, you would need to associate your script with a standard project from GCP (in case you have not done this yet). What I mean by this is that you need to create a separate project on GCP, then enable the APIs and configure the scopes and everything manually, and then associate it with your script from the script settings (see screenshot).
After all that just go to the project, then IAM & Admin >> Quotas and click "Edit quotas". This is also officially documented here and make sure that billing is enabled for the project.
What you would be doing with all this is submitting a request for the Google team in charge to review it and decide if approve it or not. It can take a couple of days for you to get a response from them.
I can't guarantee that the quota that you need to increase would be available, but at least this is how you can request any quota increase for any script you may have.
If you already have a project from GCP with the Apps Script API enabled, you can just follow the instructions to submit the request without having to follow the other steps.

How to reload gmail add-on through background process using app-script

May i get some help on the below points where i am using app-script to develop a gmail add-on:
How can we refresh gmail add-on with back ground process?
=> Here is my case, I need to display card with multiple sections which is the process of hitting multiple apis to fetch data and to display the card. For this initially we will show a card with minimal information to the user once i get information from api, i need to update the basic cards with complete information.
How can we trigger a function on every mail thread open?
=> Currently it works once for a mail, here as explained above point need to refresh a card once we fetch the data. If not, user will be seeing same basic information card every time he opens the mail.
From above mentioned issues for point one we are trying to get solution where we can hit service for certain interval of time to check data availability and if data exists then fetch data and update cards, i mean to say need a setTimeout function kind of thing, unfortunately we did'nt found this in app script and We found sleep/waitLock functions in app-script, but my services may take little time to fetch data as it connects though multiple services so we cant make the user to wait until the whole process is to be completed. So that we will show a card with basic information required then after need to auto refresh the cards once we fetch the data. we tried of keeping refresh button for the user to click and fetch the updated data but here we are losing user experience, trying for auto refresh with out user interference to get updated information.
Need a process / solution where we can auto refresh the card with out user interference after the data available at our end instead of making user to wait until the process to be completed.
Earliest reply will be more helpful for us.
Thanks.
If a data status on a third-party backend changes as the result of a user interaction with your add-on UI, it is recommended that the add-on set a 'state changed' bit to true so that any existing client side cache is cleared. See the ActionResponseBuilder.setStateChanged() method description for additional details.
The card-based interface in Gmail Addons is an Apps Script Service.
You can interlink it with other Apps Script services as well as implement API calls - everything within the same Apps Script file.
Gmail Addons contents automatically update every time the user opens a different e-mail or refreshes his browser.
Within your Apps Script code you can install time-driven triggers to run the data availability check with a customized frequency.
Consider to install for your users an Auto Refresh extension if you do not want them to refresh the card themselves.

Automate the oauth authentication without browser in cron utility

I am trying to upload some documents on Google drive, i want to run a cron script which is executed at mid night every day and the files generated as a result of it should be uploaded on the uses Google drive.
I tried the standalone script, which uploads document on Google drive, but for that i have to every time do allow access via browser.
However my purpose is to run a cron and upload the files, at the time the cron executes there will be no browser access.
Is there any way i can do the authentication process without manual intervention.
any help in this case would be really appreciated.
THanks,
you can authorize your App(script) with Google Drive.
Here, you mentioned you are writing a script which upload docs to your Google Drive.
I suggest you register a app in Google Cloud Console to get client ID and client Secret firstly,
and turn on Drive API for you registered App.
Then use this client ID and Secret to run oauth flow in your script to get an access token and refresh token, the access token's lifespan is about 3600s, and if it's expired, you can also get a new one with the refresh token.
User's interaction(consent) is required only in the first time you request access token.
In this way, your script can work in "a real script way".
Here are some reference:
https://developers.google.com/drive/about-auth
https://developers.google.com/accounts/docs/OAuth2InstalledApp?hl=zh-CN
I am assuming its only one user drive account you are uploading to. Have you considered using a service account fo this? https://developers.google.com/drive/service-accounts
If its not a single user account you are uploading you can just save the refresh token some place and use that to get a new authtoken every night.
Hi i figured the problem,
i was generating refresh token from oauthplayground and was trying to integrate it in the php script....which was invalid......
I then printed the refresh token returned for the first time when a user allows access and used that for future generation of access token and it works like charm. thanks All for help

Google Script OAuth for multiple users

I've created a Google App Script that handle 2 different OAuth connections.
1- Google itself to send mail on behalf of the user and access google docs (google api console used to get keys, secret)
2- gtraxapp wich is a timesheet cloud-based app. (Script is registered, got a key/secret, etc.)
The script is published as a web app. It works perfectly for my user.
When logged on a different user name, I can authorize Google OAuth without providing different key/secret, and emails will be sent from the actual user.
Problem happens with the 2nd app (gTrax).
Authorization seems to work. Running the function inside the script to authorize lead to a screen asking for permission, gtrax then appears in the account as a registered app (could revoke access if needed).
But, when running the app, I get a message saying I need permission to do this action (UrlFetchApp / simple get)
My question is :
Is this possible that I need to register each user to get a key/secret for everyone (and dealing with that in the script)...
Or do OAuth can be registered with 1 key/secret ?
In other word, are (should) key/secret linked to a single user or are they only a kind of RSA-like key pairs that, when verified, can be used to authorize any user.
My understanding is this. When you use built-in Apps Script functions, like MailApp.sendEmail, the Google Apps Script "environment" takes care for you to ask authorization for the user (1st time he access your app) and save and manage the oAuth tokens for you, so it all runs smoothly.
When you call an external service using UrlFetchApp, Apps Script oAuth authorization process works differently. The authorization is just a strange popup you get on the script editor, when you actually make the fetch call. It is not processed at "compile time" and asked before you run anything like the other services. But you also do this step only once.
The "gotcha" is that this different authorization process does not work when a user is running the app as a webapp. AFAIK it only works from the script editor itself or running directly from a spreadsheet.
If your users are just a known few, you could advise everybody to open the script editor (or a spreadsheet that contains it) and run an specific function that will just attempt the UrlFetchApp.fetch call so the popup shows up and they authorize it. Once this step is done, they can use the webapp normally. Apps Script will do the magic for you after that.
But if you plan to share this broadly, say at the Chrome Web Store, and don't want to ask every user to do this somewhat strange step, then you'll need to manage all the authorization process yourself. It means, you'll have to register your app with the third party service (if it's Google's, it's at the API Console), where you will receive a client id and a client secret. With those you'll have to place a "Authorize" submit button on your app html that will redirect the users to the 3rd party authorization url, providing the correct scope, etc. When they authorize it, the 3rd party will redirect the user back to your app providing a code token as URL parameter. You'll use this code to call the 3rd party oAuth service to get the real access and possibly refresh tokens that you'll have to use on your UrlFetch calls. You'll be responsible to save these tokens, refresh them when they expire and so on. Not a very simple procedure :-/
Oh, and although your app have only one id and secret, the tokens are per user. Which makes sense, since each call you do must be on behalf of a specific user and he *must* have authorized it.
I hope this helps.