Zendesk - How do we can read data of currently opened tickets in server side app? - zendesk

I have an app which is server side. my task is to read and display data from on currently opened tickets in my server side app.
is it possible? or what can be best solution for doing this?
Thanks

I assume you have set your app's entry point url in the manifest files as follows:
...
"location": {
"support": {
ticket_sidebar": {
"url": "https://my.app/index.html"
}
}
},
...
You need to import ZAF SDK into your app which will enable you to use the client to access ticket data. Refer to apps API here.
Note that you will get an error on your server side app url because the ZAF client will only be defined within Zendesk. This is expected. So make sure you only test it on you Zendesk instance.
Refer to official tutorial here

Related

How to distinguish each Slack app installation?

I'm using Slack Bolt JS api. Can successfully install apps into slack workspaces following the http://example.com/slack/install URL. I'm trying to integrate this into a SaaS. The question is how to distinguish Slack app installations and how to determine which Slack app installation belongs to which of the SaaS user? My guess is that some information should be injected during the OAuth flow, but now sure how to do that using Slack Bolt SDK.
const app = new App({
installerOptions: {
installPath: '/slack/install',
redirectUriPath: '/slack/oauth_redirect'
},
// token, etc
});
seems like you need to implement authentication with OAuth and your own installationStorage. Take a look this doc
The basic steps that you need to cover are:
You need to start you app with SLACK_CLIENT_ID, SLACK_SECRET_ID and SLACK_SIGNING_SECRET
Include your custom callbacks to handle app installation (installationStore option).
In the above example, you will need to replace database.set and database.get by your own database query, server API or something else. Here you can see a full example.
After this setup, slack will call your app from many different workspace and the correct token will be recovered thowth installationStore.fetchInstallation. This will happen before call the event or message handler.
PS: You should not include token in the initialization of the app. It will be set later.

Auth0 React JS Quickstart Not Requesting all scopes

I am currently using the react JS quick start available at the following link.
https://github.com/auth0-samples/auth0-react-samples/tree/master/Sample-01
About a year ago, I was able to repurpose it. That old app is still working fine, able to authenticate, authorize and also make calls to a custom API.
On the old app, I am getting all the scopes.
“scope”: “openid profile email read:profiledetails read:seeallquotes read:sitestats read:testperm1 read:testperm2”
Now, I have made a fresh copy of the react app using the quick start option, from the same auth dashboard as the old app. Updating the config file to match the old app config files. I get the following scopes
“scope”: “openid profile email”
Why am I not getting all the scopes as per the user login? Same user, on the old app, gets all the scopes. I believe, the new react app is not asking for all the scopes when it asks for token. But, I have updated all the scopes I need in the auth config.
Both apps - old and new - have the exact same auth file, and are linked to the same auth0 server, same custom api, same everything. I am also using the same user account for testing on both the apps.
{
“domain”: “removedonpurpose.us.auth0.com”,
“clientId”: “removedonpurpose”,
“audience”: “removedonpurpose”,
“scope”: “read:current_user update:current_user_metadata read:capquotes read:penquotes read:profiledetails read:seeallquotes read:sitestats read:testperm1 read:testperm2”
}
Why is this happening?
What else should be included in the react app to make it ask for all the scopes?
This question is related to the original question I posted on the Auth0 forums. Linking it here. https://community.auth0.com/t/scope-not-included-in-token-call/65173
Right after I posted this I discovered that the latest version of the react quick start makes some changes.
especially the following.
// Please see https://auth0.github.io/auth0-react/interfaces/auth0provideroptions.html
// for a full list of the available properties on the provider
// const config = getConfig();
// const providerConfig = {
// domain: config.domain,
// clientId: config.clientId,
// ...(config.audience ? { audience: config.audience } : null),
// redirectUri: window.location.origin,
// onRedirectCallback,
// };
I missed this part. in the old app, the configuration was done differently. It looked something like this.
<Auth0Provider
domain={config.domain}
clientId={config.clientId}
audience={config.audience}
redirectUri={window.location.origin}
onRedirectCallback={onRedirectCallback}
scope={config.scope}
>
<App />
</Auth0Provider>,
with the settings read directly from JSON.
Anyway, I went back to the old way for now. The quick start tutorial still shows the old options which threw me off as I was using the tutorial as reference and did not discover that they made changes.
Not blaming the tutorial. I should have investigated in the beginning.

Teams notifications are not received when using Graph's sendActivityNotification

I've created a Teams app using the Teams App Visual Studio template, and configured it with a single personal tab. I've set set up ngrok so that this can be debugged locally. I've sideloaded the app, and all looks fine - Teams can load the tab, and it displays as it should.
I'm now trying to send an activity notification to this tab. Graph accepts the post activity just fine - I'm returned a 204 - but the activity is never delivered to my Teams client.
My test teams user and the Azure AD app are configured in the same tenant. The Azure AD app has the TeamsActivity.Send permission.
All URLs in my manifest are configured with the ngrok endpoint. I have a valid activityType defined, and my webApplicationInfo section is configured with the AAD App ID and redirect URI as outlined here. I've also added TeamsActivity.Send to the applicationPermissions section of webApplicationInfo
I'm posting the following json to Graph:
{
'topic': {
'source': 'entityUrl',
'value': 'https://graph.microsoft.com/beta/users/<my user id>/teamwork/installedApps/<my app id>'
},
'activityType': 'testActivity',
'previewText': {
'content': 'Something happened'
},
'templateParameters': [
{
'name': 'teammember',
'value': 'Bobby muffin'
}
]
}
This all ties up correctly with the manifest, and as I mentioned, Graph accepts the POST just fine. I've also tried adding the "recipient" section to the json, but get the same result.
I have no idea why I'm not seeing notifications. After I post the notification, I don't see any traffic to ngrok (although I'm not sure whether the notification would come in that way, or via the Teams client).
It feels like I'm missing some config somewhere.
My bad... while I was testing this, I was trying to send a notification to myself, which is explicitly not supported - https://learn.microsoft.com/en-us/graph/teams-send-activityfeednotifications#faqs

places not found using google places api in iOS

I am trying to show nearby places with selected types
types - Bar, Cafe, ATM etc
I have created project on developer console.
enable API (google places api, google map sdk, direction api)
I have created iOS api keys but Api key not working. I got this error message
This IP, site or mobile application is not authorized to use this API
key. Request received from IP address 114.143.244.10, with empty
referer
When I tried browser api key I got this error
This API project is not authorized to use this API.
Please ensure that this API is activated in the APIs Console: Learn
more: https://code.google.com/apis/console
I am using this url
NSString *url = [NSString stringWithFormat:#"https://maps.googleapis.com/maps/api/place/search/json?location=%f,%f&radius=%#&types=%#&sensor=true&key=%#",
currentCentre.latitude,
currentCentre.longitude,
[NSString stringWithFormat:#"%i", currenDist],
googleType,
kGOOGLE_API_KEY
];
I didn't get what is the problem.
Enable to this api Google Places API Web Service & Google Places API for iOS in the APIs Console
Refer to this document....
Google Places API Web Service
https://developers.google.com/places/webservice/search
Please Check Your All API are Enable On The Google Developer Console
Step 1 Go to Developer Console
Step 2 API Manager ==> API Library ==> Google Maps APIs ==> More
Step 3 And Enable ==> Google Places API Web Service
(AutoComplete and Seaching)
Step 4 Done Enjoy (^_^) ALl Is Done !!!!
NOTE:- Make Sure Your API KEY is Proper and Created Okay ....
I think i know your problem now, it possible that you missed a step..
the steps are suppose to be:
1) Go to Developer Console https://code.google.com/apis/console/
2) In the Credentials, under Public API Access , Create New key
3) Select the server key from the option.
4) Enter your IP Address on the field and if you have more ip addresses, you can just add on every single line.NOTE: Enter the IP Address only when you want to use it for your testing purpose. Else leave the IP Address section blank.
5) Once you are done, click create and your new Server Key will be generated and you can then add that server key to your URL.
use it like:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=[lat],[lon]&radius=[radius]&key=kGOOGLE_API_KEY&sensor=true
or from the tutorial that you are using..
https://maps.googleapis.com/maps/api/place/search/json?location=[lat],[lon]&radius=[radius]&types=[type]&key=kGOOGLE_API_KEY&sensor=true
as you can see &sensor=true is the last parameter..(don't trust anything on the internet).. hahaha..
everything must have been working if you have followed, carefully.. i suggest do it from the top.. hahaha.. Lols.. you'll know and learn what's missing/forgotten, and that'll help you be a better person.. Lols.. Good luck sir.. :)
Try to use this library https://github.com/FuerteInternational/FTGooglePlacesAPI with your key and let me know.

Cannot get samples to work with youtube-api; authorization problems

I'm trying to run sample: https://github.com/youtube/api-samples/blob/master/python/search.py and am getting errors. That is, I'm unsure what to replace DEVELOPER_KEY with.
Since I'm guess I'm not using OAuth, I should have Public API, but am unsure how to proceed, since all I want to do is run from terminal this script and get some output.
I've tried creating Server Public API access with ip set to 0.0.0.0/32; but when trying to run this sample with API key I get the following error:
An HTTP error 403 occurred:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
}
],
"code": 403,
"message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
}
}
Ideally, my goal is to run a search query, get top few videos and print their view count.
EDIT:
I've opted out for using server API access with any key accepted. I fiddled with 0.0.0.0/32 because I misunderstood if I left the field blank any IP would be accepted. Now it works.
First you need to register your application.
STEP 1.
Creat a project. It's a large button you cannot miss him !
STEP 2.
Go in your project in the section APIs
Search on YouTube API use the version 3. You need to go down the page an enable YouTube Data API v3
Basically YouTube Data API v3 is now to ON
STEP 3.
Go in the section Credentials and click :
Creat a new key
After that, you will have several options :
Two kinds of API keys are available in the Google Developers Console:
Use a server key if your application is running on a server. Never
share this kind of API key outside your server code. For example,
never embed this key in a web page. To prevent quota theft, restrict
your key so that requests are only allowed from your servers' source
IP addresses. Use a browser key if your application is running on a
client, for example from JavaScript or any other client-side
web-browser context. To prevent your browser key from being used on
unauthorized sites, only allow referrals from domains that you
administer.
So after you have your API Key (wich is public)
Then use it in your code !

Resources