Facebook apprequest notification received but not showing message - javascript

The notification is received but without the message.
Any idea why? Did facebook removed messages even that it's in the dev doc?
function newInvite(){
FB.ui({
method: 'apprequests',
title: 'Invite friends to play',
message: 'Come to play.',
new_style_message: true, // added this after a search but doesnt work either
filters: ['app_non_users']
});
}

https://developers.facebook.com/docs/games/services/gamerequests#dialogparameters:
message: A plain-text message to be sent as part of the request. This text will surface in the App Center view of the request, but not on the notification jewel
So yes, if you are talking about the notification jewel (the little globe symbol in the top bar in the web UI), this is supposed to work this way - there it will only show a text given by Facebook, “Foobar send you a request on Appname” or something like that.
Only the detailed App Center view under https://www.facebook.com/games/activity is supposed to show the message the user sending the request typed in.

Related

Android Push notification- Only show the notification message to user

I am trying to include Push Notification in my Hybrid Application.
While doing this, I am able to send the push notification message from rest client and also able to receive the notification in my Android device.
Now I want to the device user to get only the alert message which I send from the server.
For example:
In the body of my Post method,I am sending:
{
"alert": "Hello android"
}
Then, only "Hello Android" should be visible to him, even if I open the application.
Currently,when I test the above example,
when the user's app is open, he gets an alert message with details related to gcm sender, collapse_key information, apart from the alert message.
I am attaching screenshot here
function processNotification(notification) {
console.log("Hi! You have received a notification: " + JSON.stringify(notification));
alert("Hi! You have received a notification: " + JSON.parse(notification));
if(sap.Push.isPlatformIOS()){
sap.Push.resetBadge(resetBadgeSuccess);
}
}
Any Help would be appreciated

Having an hard issues with google and his API or login buttons

I followed the documentation from them and i don't see what is my error from my part !
I'm trying to get the information from the profile of the user (which could be the name gender etc etc...)
And i followed all the steps from google website (in my case, the javascript code)
Everything works, less that request which i want to do to the user profile!
This example is the callback function after logging to the google account which is automatically executed:
function signinCallback(authResult) {
if (authResult['status']['signed_in']) {
// Update the app to reflect a signed in user
// Hide the sign-in button now that the user is authorized, for example:
//document.getElementById('signinButton').setAttribute('style', 'display: none');
console.log(authResult);
gapi.client.setApiKey('API_KEY'); //(That function gaves me an error which is invalid credentials, i did put my API_KEY (from the google console ))
gapi.client.load('plus','v1', function(){
var request = gapi.client.plus.people.get({
'userId': 'me'
});
request.execute(function(resp) {
console.log(resp);
//console.log('Retrieved profile for:' + resp.displayName);
});
});
gapi.auth.signOut(); // logging out !
} else {
// Update the app to reflect a signed out user
// Possible error values:
// "user_signed_out" - User is signed-out
// "access_denied" - User denied access to your app
// "immediate_failed" - Could not automatically log in the user
console.log('Sign-in state: ' + authResult['error']);
}
}
Everything works less than setAPIkeys and everything below !
If i don't put the set function and the code below, i receive an 400 error ("message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.").
So i'm losing hope in doing that sincerely ... i think that google's documentation is awful !
What's wrong with that?
Merry christmas to everyone !
P.S. : yeah i know that the API key musn't be hard coded, but i'm so lost with the documentation from google sincerely ...
Possible solutions:
Try removing
gapi.client.setApiKey('API_KEY');
and
gapi.auth.signOut(); // logging out !
signOut works very fast, while gapi.client.load is asynchronous function which loads js code. User is probably signed out before gapi.client.load callback is executed.
I'm not sure if that's required:
Go to the Google Developers Console.
Select your project.
In the sidebar on the left, select APIs & auth.
In the displayed list of APIs, find the Google+ API and set its status to ON.
Make sure you're requesting scope https://www.googleapis.com/auth/plus.login or https://www.googleapis.com/auth/plus.me while signing in.

Firefox - displaying web notifications from extension/addon

I'm building Firefox addon (with addon-SDK) and I'd like to display desktop notification to a user.
There is Notification object but it doesn't seem to work from addon code (background page). There is no error etc, but no dialog for permissions is displayed, so no notifications can be displayed. I've tried of course adding permissions/desktop-notifications but no effect.
Edit: pasting sample code I've tried (the code is located inside callback function for socket.io event. Event is received properly, but no notification is displayed, or request for permission.
Notification.requestPermission( function(status) {
console.log(status); // notifications will only be displayed if "granted"
var n = new Notification("title", {body: "notification body"}); // this also shows the notification
});
I've also found alerts service this one works. However alerts disappear quite fast (too fast for me) - edit: that's the way it works - so guess no code sample needed, as I don't see any option to make them last longer.
Is there any way to display chrome like notifications on Firefox? (chrome.notifications.create) Or at least use web notifications object from within the addon?
If you're using the add-on SDK, you're looking at the wrong docs. Here are the notification docs.
You create a notification like so:
var notifications = require("sdk/notifications");
notifications.notify({
title: "Jabberwocky",
text: "'Twas brillig, and the slithy toves",
data: "did gyre and gimble in the wabe",
onClick: function (data) {
console.log(data);
}
});
All the docs you look at should be a subset of developer.mozilla.org/en-US/Add-ons/SDK.

How to sent a website url as link to multiple Facebook Friends?

I am setting up a website. I want users to invite Facebook friends to look at the page the users can make on my website. So i'm trying to get it done. But i think the FB Api is not set up to do what i want to do. I think it is to prevent from spamming, but i really like to know if it can be done or not.
This is what i have so far. Users can login with FB and i present a decent list of FB friends.
Each friend has a checkbox. When a user submits the form, i collect all the checked friends id's:
var sendUIDs = '';
var mfsForm = document.getElementById('mfsForm');
for (var i = 0; i < mfsForm.friends.length; i++) {
if (mfsForm.friends[i].checked) {
sendUIDs += mfsForm.friends[i].value + ',';
}
}
While i was trying, i came up with this "sollution" for sending all the friends the same invite:
FB.ui({
method: 'apprequests',
to: sendUIDs,
message: "Hey come on look at my site",
data: "mywebsite.com/userlink"
});
Looking great I thought. Exactly what i wanted... i thought.
Unfortunately this is only used for games? First of all i could not find the invite. It was there, but it seems to disappear. Then i found out it was in the App/Games/Activity tab.
I managed to get the notification in the "notification" tab by adding a Canvas to my FB App. Almost there i thought. Well, not exactly... I want the friends to visit my page by the given data link and not some weird ?number.
So i gave up this path and tried the other way and came up with this:
for (var i = 0; i < mfsForm.friends.length; i++) {
if (mfsForm.friends[i].checked) {
var uid = mfsForm.friends[i].value;
FB.ui({
to : uid,
method: 'send',
name: 'Visit my page',
link: 'mywebsite.com/userlink'
});
}
}
This works more or less, but produces a popup for every friend with an empty message box. Not very friendly and, well... stupid :)
I also tried the former setup, but instead of "apprequests" i used this:
FB.ui({
method: 'send',
to: sendUIDs,
message: "Hey come on look at my site",
data: "mywebsite.com/userlink"
});
where i tried this for the sendUIDs: [1, 2, ...] and just 1, 2, ...
No luck, because FB only processed one name.
I would think there must be a way to get the job done, but for now i am very confused how to proceed. I would think FB could make things a bit more easy?
The Send and Share Dialogs are built for this (sharing a Website URL on a wall or send it to friends in a PM), just let him choose the friends in the popup. That way, you don´t even need to authorize the user, and you can´t get ALL friends anyway (only those who authorized the app too).
About the message parameter: You are not allowed to prefill the message, it has to be 100% user generated. See the Platform Policy: https://developers.facebook.com/policy
2.3 Ensure that all content in the user message parameter is entered by the user. Don’t pre-fill. This includes posts, messages, comments,
and captions.
The FB.ui Dialogs ignore the message parameter anyway.

Send a message to a friend, I wonder Javascript API

I am a developer from the Republic of Korea.
I am currently making Facebook and Twitter-based websites.
I want to use a JavaScript API that can send message to friends,
So I consulted the iframe Javascript API methods or using Facebook page looked as sending.
I wonder,
I use to send messages to friends as a Javascript API that provides a?
I do not know English well. So I used Google translator.
Please understand.
(Edited, fixed some grammar and rewording)
FB.api (path, "post", {
message: msg,
caption: "caption caption",
link: "http://www.naver.com",
description: "Description Description",
picture: "http://sstatic.naver.net/search/img3/h1_naver.gif",
tag: "Tag",
name: "name names",
access_token: accessToken
}, Function (response) {
if (! response | | response.error){
alert ("error");
}
else{
alert (response.id);
}
})
You want to send a message to a friend on Facebook, or post to the Facebook wall for all to see? I am going to assume sending a message to a friend on Facebook.
Manual
If you want to send a message to friends on Facebook using the JS SDK, follow these instructions: https://developers.facebook.com/docs/reference/dialogs/send/
This isn't automatic and will still show a dialog box for the user to confirm.
Automatic
If you wanted to do it in the background via the Graph API, you can't. Here is a link explaining it in further detail why you can't and other options you have: https://stackoverflow.com/a/4061298/540339

Categories