https://developer.github.com/v3/activity/notifications/
I am trying to use the Github Notifications API to display notifications like
"someone followed my repo", "someone followed me", "someone commented on my repo", etc.
on my Android application.
Before using it, I tried to understand how it works.
When I tried doing
GET https://api.github.com/notifications?access_token="mytoken"
on Postman to see what if gives, it just gave me
[]
When I asked my friend to follow me on Github, I expected something to appear in the response, but it still gave me
[]
after my friend tried to follow me.
In what case do I get a response, and how am I supposed to use it to fulfill my purpose?
Axibase developed a set of handy tools that use the GitHub API to create and send Webhooks based on the events you're describing.
The workflow for the Repo Watch notification is shown here, it's the same for each tool just a different flavor based on the alert event:
The whole set-up process takes less 10 minutes, follows this guide and runs in a Docker container which is pre-configured in the launch command. The procedure is goes like this:
From the Linux command line, launch ATSD with the following command:
docker run -d -p 8443:8443 -p 9443:9443 \
--name=atsd-sandbox \
--env SERVER_URL=https://atsd.company_name.com:8443 \
--env WEBHOOK=github \
--env SLACK_CONFIG="slack.properties \
--volume /home/user/slack.properties:/slack.properties \
--env ATSD_IMPORT_PATH='https://raw.githubusercontent.com/axibase/atsd-use-cases/master/how-to/github/resources/github-watch.xml' \
axibase/atsd-sandbox:latest
(Remove the terrible spacing that SO requires for code posts)
Replace the SERVER_NAME parameter with the public DNS name of the Docker host where the sandbox container will be running
What you're getting here is a local ATSD instance with a generated Webhook. The command is bootstrapped for Slack, so you need to create an .xml directory on your local machine or URL with the following parameters and then replace the slack.properties template variable with the appropriate path:
token=xoxb-************-************************
channels=general
Watch the Docker Logs, and copy the Webhook. It will look something like this:
Webhook URL: https://github:PdWnC1jF#atsd.company.com:8443/api/v1/messages/webhook/github?exclude=organization.*;repository.*;*.signature;*.payload;*.sha;*.ref;*_at;*.id&include=repository.name;repository.full_name&header.tag.event=X-GitHub-Event&excludeValues=http*&debug=true
Open the GitHub Settings menu for the repo for which you'd like to create notifications:
Configure the Webhook by pasting the one generated at runtime into the appropriate field and configure the remaining settings:
Confirm connectivity (GitHub will do this automatically), and you're ready to go.
Use one of these other guides according to the event which you'd like to trigger a notification. The really nice thing about them is that they can alert via third-party messenger so the notifications are send directly to your smartphone instead of just through email.
Disclaimer: I've worked for the development team that writes ATSD, which is the database responsible for the underlying data processing and management tasks.
Good luck!
Related
I have never come across a worst api documentation than Facebook .
I have been trying to deep link my android application with the facebook , such that when a person presses a story of my app on his facebook , it doesn't launch the browser , rather opens up my app .
I have followed this https://developers.facebook.com/docs/applinks/hosting-api and came across this piece of raw code through which I can generate a deep link .
curl https://graph.facebook.com/app/app_link_hosts \
-F access_token="APP_ACCESS_TOKEN" \
-F name="Android App Link Object Example" \
-F android=' [
{
"url" : "sharesample://story/1234",
"package" : "com.facebook.samples.sharesample",
"app_name" : "ShareSample",
},
]' \
-F web=' {
"should_fallback" : false,
}'
NOW WHAT ? . How should I actually run this request against the facebook server? . I ofcourse can't curl it , from android . Also how should I generate this app access token ?. I actually have so many questions right now .
I would really appreciate if anyone could point me to the correct direction.
You should run this from your own machine or server, and not in an Android app. The hosting API is not meant for creating thousands of URLs at runtime, it's meant for creating a handful of URLs that you will share and that your app understands. If you need to create or attach custom parameters, just add them to the end of the URL that's created for you, instead of creating new ones.
This is the first result for "facebook app access token" on google: https://developers.facebook.com/docs/facebook-login/access-tokens, there's a section on app tokens. The easiest way to create an app token is to just use app_id|app_secret, so if your app id is 123 and your app secret is def, your app access token is 123|def
As the first step in creating a cloud based mobile app I chose to try out the Google Cloud trial period. So as per the instructions in https://console.developers.google.com/start/appengine?_ga=1.92011098.1535487967.1418404546, I installed the Google cloud SDK and Google App engine and tried out the following code snippet as mentioned in the instructions.
from bottle import Bottle
bottle = Bottle()
# Note: We don't need to call run() since our application is embedded within
# the App Engine WSGI application server.
#bottle.route('/')
def hello():
"""Return a friendly HTTP greeting."""
return 'Hello World!'
# Define an handler for 404 errors.
#bottle.error(404)
def error_404(error):
"""Return a custom 404 error."""
return 'Sorry, nothing at this URL.'
As per instructions, I
Sign in to Google Cloud Platform using this command: gcloud auth login
Install the App Engine package for Python using this command: gcloud components update gae-python
Start a local server using this command: dev_appserver.py appengine-try-python-bottle
However, it generated the following logs (which I am not allowed to share here apparently because I haven't earned some points here) and localhost:8080 was blank. Can you please help me understand what am I missing here ?
After putting bottle.py in the root directory and deploying it to GAE, the following code should work (template, static_file etc. will be probably useful for further development of the app so I am leaving them):
from bottle import route,run,template, view, request,response
from bottle import static_file
from bottle import Bottle
from bottle import default_app
from bottle import url
#route('/login')
def getHandlerLogin():
return "<h1>Hello world</h1>"
app=default_app()
Using bottle with GAE is not at all difficult, but in the long run it might be easier to use webapp2.
Look here for an answer: https://github.com/GoogleCloudPlatform/appengine-bottle-skeleton
Those instructions worked perfectly for me.
Ok, for a starter, I think you shouldn't be using Bottle (or any other unsupported framework) on GAE. It's possible to use them, but it's not simple. It's what may be preventing your GAE app from starting. In all cases, we need more debug data!
Try using Webapp2. It was the first framework in python I ever used, but it was really simple to use (really, no more than Flask or Bottle). Here' the doc : https://cloud.google.com/appengine/docs/python/gettingstartedpython27/usingwebapp
If you really want to use Bottle, being a WSGI-compliant microframework, it's apparently not so hard to set it up on GAE. Maybe use this outdated tutorial to try and make it work. There's this github that might also help you bootstrap your project.
We've got a Cordova based iOS app that does not use push notifications. As of Cordova 3.5.0, each submission we have made to the app store results in an email informing us that our app includes API used to register with Apple's Push Notification Service, but doesn't have push notification entitlement.
The app has been accepted each time, as we don't actually use push notifications for anything. However, I would like to avoid triggering this warning in case Apple decides to change their policy as to whether these API references are acceptable.
We did not experience the issue with prior versions of Cordova, and have done no work in Objective-C ourselves. Is this a known issue with Cordova 3.5? Searching has yielded some folks with similar problems but I've only found solutions for people wanting to add push entitlements, (rather than figure out where the Push API is being referenced and remove it). I took a look at the Cordova issues ML, but didn't find anything there. Any other leads that folks are aware of would be appreciated!
Plugins used:
org.apache.cordova.console
org.apache.cordova.device
org.apache.cordova.file
org.apache.cordova.inappbrowser
org.apache.cordova.media
org.apache.cordova.network-information
org.apache.cordova.splashscreen
Relevant email snippet, specific info replaced with [ ]:
From: iTunes Store
Date: Wed, Sep 17, 2014 at 3:49 PM
Subject: iTunes Connect: Your app "[appName]" (Apple ID: [id]) has one or more issues
To: [developer]
Dear developer,
We have discovered one or more issues with your recent delivery for "[app]". Your delivery was successful, but you may wish to correct the following issues in your next delivery:
Missing Push Notification Entitlement - Your app appears to include API used to register with the Apple Push Notification service, but the app signature's entitlements do not include the "aps-environment" entitlement. If your app uses the Apple Push Notification service, make sure your App ID is enabled for Push Notification in the Provisioning Portal, and resubmit after signing your app with a Distribution provisioning profile that includes the "aps-environment" entitlement. See "Provisioning and Development" in the Local and Push Notification Programming Guide for more information. If your app does not use the Apple Push Notification service, no action is required. You may remove the API from future submissions to stop this warning. If you use a third-party framework, you may need to contact the developer for information on removing the API.
After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.
Regards,
The App Store team
HOW TO DO THIS VIA THE XCODE UI (6.1):
While commenting out the offending code in Classes\AppDelegate.m will get your app approved, you want to continue benefitting from future Cordova upgrades so the best way to do this is to turn on the DISABLE_PUSH_NOTIFICATIONS symbol during compilation so this bit of code gets left out.
I come from a C# background so I understand conditional compilation but I am new to XCode so I had to do a bit of research finding out how to define compilation symbols via the UI.
Turns out the magic words are 'Preprocessor Macro'. This is how the you can accomplish this graphically (note that this the way its done in XCode 6.1):
Hope this helps other people out there in same situation.
Krik is right ! I've found this API calls in /Classes/AppDelegate.m certainly generated by Cordova 3.5.
I din't tried it for the moment, but these lines can certainly be commented in xCode to avoid Apple's warnings.
- (void) application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
// re-post ( broadcast )
NSString* token = [[[[deviceToken description]
stringByReplacingOccurrencesOfString: #"<" withString: #""]
stringByReplacingOccurrencesOfString: #">" withString: #""]
stringByReplacingOccurrencesOfString: #" " withString: #""];
[[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotification object:token];
}
- (void) application:(UIApplication *)application
didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
// re-post ( broadcast )
[[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotificationError object:error];
}
Have you had the Push Plugin installed at some point? Sounds like you have the respective Code somewhere in your application package. I'd do a project-wide search for the specific API calls e.g:
didRegisterForRemoteNotificationsWithDeviceToken
didFailToRegisterForRemoteNotificationsWithError
The dead code, files need to be removed.
Heres' the full documentation: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW2
As Charles Merriam points out, newer versions of cordova-ios make it easy to disable touching push notifications by setting the preprocesor flag DISABLE_PUSH_NOTIFICATIONS. (See bug history.)
You will need to cordova platform update ios, platform uninstall ios and platform install ios to get the new in AppDelegate.m. (Maybe there's a better way than blowing away the folder?)
I found a Cordova on_platform_add hook script that will edit project.pbxproj with that flag for you when you install the iOS platform. I needed to npm install xcode to get the hook script to work.
Both kirk and r121 are correct.
In more recent versions of Cordova, this offending code is now helpfully generated inside a wrapper of #ifndef DISABLE_PUSH_NOTIFICATIONS. All you need do is add-DISABLE_PUSH_NOTIFICATIONS to your compiler flags. That's set in target/Build Settings/Custom Compiler Flags/(both C and C++ release) for those building inside XCode.
In our build process, we have been blowing away and rebuilding the AppDelegate.m file a lot. The hack I use is:
sed -i "" -e "s/ifndef DISABLE_PUSH_NOTIFICATIONS/if 0/" build/cordova/platforms/ios/gThrive/Classes/AppDelegate.m
# That uses the os/x sed to not have push notifications in the app
which just makes the problem go away.
My Android application have to synchronize data in the first time. It spend about 15 minute for synchronization. And in secondtime, I don't need get data from server. But when a run calabash to test feature:
calabash-android run MyApp.apk
I feel it remove all data in my app and rebuild application.
So, how to keep data when I run feature Scenario for my app?
My scenario :
Feature: create work order
As a techinical
I want to create work orders
So I can manage WO easier
Scenario: Technician create work order successfully
Given I am on the Create Work Order Screen
And I select customer name which is "Harris Teeter"
And I select equipment serial number which is "1A100438"
And I select Job code "1" and then is "100 HOUR SERVICE"
And I select order type "401"
And I input valid title "Create new work order"
And I input valid description "Work order description"
Then I see the successful messages "The new work order has been created successfully"
Try command
NO_LAUNCH=1 cucumber --format html --out index.html features/Your_feature_file.feature
It won't relaunch your app. But you need to run the app first time before you run this command. As long as your app in the foreground this command works.
Note: I use this for iPhone testing it should work on android too.
This is because calabash-android reinstall app before run every scenario.
To avoid that, you can comment this code in app_installation_hooks.rb file in android support folder
uninstall_apps
install_app(ENV["TEST_APP_PATH"])
install_app(ENV["APP_PATH"])
I have been following to the letter the simple tutorial on Creating an App Engine Connected Android Project using the eclipse plugin.
After setting up everything, running the project leads to two possibilities:
If LOCAL_ANDROID_RUN = false, the project spits out the expected complaints:
1) Registration with Google Cloud Messaging...SUCCEEDED!
2) Registration with Endpoints Server...FAILED
Either your Cloud Endpoints server is not deployed to App Engine, or your
settings need to be changed to run against a local instance by setting
LOCAL_ANDROID_RUN to 'true' in CloudEndpointUtils.java.
If LOCAL_ANDROID_RUN = true, the second I click "register" the app crashes! This is the part I don't get. I am running the project right out of the box. The only thing I did was change LOCAL_ANDROID_RUN from false to true.
So I have been researching for the past four hours on a resolution. I see talks about -a 0.0.0.0 or -bindAddress 0.0.0.0; unless I am setting them incorrectly (I probably am), they are not working. Sometimes I get the "error" below. So if that's my problem please, what exactly am I supposed to have in the argument box before I click apply and run?
Options:
--help, -h Show this help message and exit.
--server=SERVER The server to use to determine the latest
-s SERVER SDK version.
--address=ADDRESS The address of the interface on the local machine
-a ADDRESS to bind to (or 0.0.0.0 for all interfaces).
--port=PORT The port number to bind to on the local machine.
-p PORT
--sdk_root=DIR Overrides where the SDK is located.
--disable_update_check Disable the check for newer SDK versions.
--generated_dir=DIR Set the directory where generated files are created.
--jvm_flag=FLAG Pass FLAG as a JVM argument. May be repeated to
supply multiple flags.
Any insights on how to get this out of the box project to work?