Could you tell me how to create welcome message in telegram chat, which visible only for invited user(newbie).
Now bot is created and invited in group. When to login "newbie", chat-bot send welcome-message(for all users).
$chat = $message['chat'];
$user = $message['from'];
if (isset($message['new_chat_members'])) {
$mess_id = $this->send_message('Welcome '. $user['first_name'] , $chat);
}
How i can do this welcome message visible only for a newbie ?
PS: sorry for my english.(
Related
I am using photon chat plugin in a unity3d multiplayer game. I have added some friends and can send them private message. I want to show if that friend is online or not.
I can use on status update callback, but it will show only friends who changed status. How can I get friends who are already online?
I have gone through syntax of FriendInfo, but can not figure out how to use it.
Any small example of knowing some specific client is online or not will be really helpful.
Thank you!
To get friends status updates you send a string array with their usernames to Photon.
friends = new List<string>() { "Ford", "Zaphod", "Marvin", "Eddie" };
chatClient.AddFriends(friends.ToArray());
For all friends online you'll receive an initial update with the current status for each to OnStatusUpdate() on your IChatClientListener interface.
OnStatusUpdate( string user, int status, bool gotMessage, object message )
{
Console.WriteLine( "Status change for: " + user + " to: " + status );
}
Friends no status update is received for are offline.
You can call the event which updates the friends list via photon every 5 seconds. In that friend list in the should look something like this
foreach(PhotonFriendInfo friend in friendList)
{
Status.text=friend.IsOnline? "Online":"Offline";
}
So call event which invokes this every 5 or 10 seconds
I have social game website and my user want to get some benefit when they invite there friends. I only use login with facebook and register with facebook only with minimum detail fullname and email
My idea is using referral but i have no idea how i can do that. website register is on click step.
if(!$user) {
header("Location:$loginUrl");
} else {
// check if user is register else login
// if not register then register and take them to home page.
$firstname = mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $user_info['first_name']);
$lastname = mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $user_info['last_name']);
$email = $user_info['email'];
// all register process goes here
}
So please any idea anyone can give me about referral if u need more detail about my register i can give.
Thank you.
i want my user to login by facebook login ,i am using this code in client side
sfsClient.login("myext", param1, ""); and in extension response i want
if (event.params.dataObj.success)
{
sfsClient.myUserId = event.params.dataObj.userId;
currentUser.userId = event.params.dataObj.userId;;
sfsClient.myUserName = event.params.dataObj.userName;
currentUser.userName = event.params.dataObj.userName;
dispatchEvent(new myEvent(myEvent.onLogMessage, "Getting Room List"));
sfsClient.getRoomList();
can anybody explain how should be my extensionside code,ADVANCE THANK YOU
i think you should use the facebook Api for java , here's a usefull link :
Java Facebook Api
I'm developing a website with the following requirement:
Users may invite their facebook friends to visit the website
Invited friends receive a personalized URL that points back to the website (either a message, notification, request...doesn't matter)
Example flow:
1. John visits http://www.mysite.com
2. John clicks the Facebook connect button and logs in with his facebook credentials
3. John clicks 'invite friends' button. The friend selector dialog appears
4. John selects Mary and submits the invitation/request/message
5. Mary receives a link like: http://www.mysite.com?name=Mary
6. Mary clicks the link from within facebook and is redirected to the URL above
7. My site displays: "Hello Mary!", taking the name from the URL parameter
I already managed to make steps 1-4.
I'm asking about step 5. Is that possible at all? I know I can get the facebook IDs of the people selected in the multi-friend selector, and that I can make a FBQL query to retrieve the names of the people selected, but how to customize the URL sent?
Cheers,
Nacho
Well, if the user will be sending invitations for a bulk of friends then these invitations won't be "invitee unique" (As mentioned by #Jimmy). BUT you can still capture the unique "friend id" and (I suppose) name from the request itself!
What you need to do is the following:
When a friend clicks on the invitation, he/she will get redirected to the canvas page (or the bookmark page if it has been sit).
Along with the redirection you'll receive the invitation number (request id) here you can read this request and extract the "To" field from it and then redirect the friend to your website.
Something like:
<?php
if( isset($_REQUEST['request_ids']) ) {
// Requesting an application token
$APPLICATION_ID = "APP_D";
$APPLICATION_SECRET = "APP_SECRET";
$token_url = "https://graph.facebook.com/oauth/access_token?" .
"client_id=" . $APPLICATION_ID .
"&client_secret=" . $APPLICATION_SECRET .
"&grant_type=client_credentials";
$app_token = file_get_contents($token_url);
// You may have more than one request, so it's better to loop
$requests = explode(',',$_REQUEST['request_ids']);
foreach($requests as $request_id) {
// Get the request details using Graph API
$request_content = json_decode(file_get_contents("https://graph.facebook.com/$request_id?$app_token"), TRUE);
// An example of how to get info from the previous call
$to_name = $request_content['to']['name'];
// When all is done, delete the requests because Facebook will not do it for you!
$deleted = file_get_contents("https://graph.facebook.com/$request_id?$app_token&method=delete"); // Should return true on success
echo "<script>top.location.href='http://www.mysite.com?name=" . urlencode($to_name) . "'</script>";
}
}
?>
For more read the following:
Facebook Documentation
How To: Handle Application Requests Using The Facebook Graph API
When the referred user lands on your site, you either need to know their Facebook User ID or all the information you plan to show them. It's going to be easier and more extensible to use the User ID, and to get that you'll need to get that user to install your app before you can identify them, look up their name, and say "Hello Mary!"
What I'd do here is let the referring user share a link customized for him. So if I'm A, and I'm sharing with my friends, my link would look like http://www.somedomain.com/?ref=A. I share this, my friend B clicks the link. When B gets to the install screen, he installs, and now we know B's name, and since we have the ref parameter, we know he clicked my link. (This is how Groupon and Dropbox handle referral links.)
And to answer your question more clearly, no, invite links need to be the same for each invitation you send using the multi-friend selector, so per-invitee links are not an option.
I have a facebook application that is published at facebook platform and i used facebook API to invite friends and i have succeeded in creating invitation form but the problem is that when u invite friend and send invitation and the invitation request sent to the user and the user accept it this friend appears again in the friend list that can be invited again
For example :
i have friend in my friend list named X and when i send invitation to him the invitation is sent and and X accept the invitation and when i try to send invitation again the friend X appears again in the list that i can select from to send invitation this means that may i send an invitation to this user (X) and he is already playing the game i need to know how to fix this problem so friends appear in the friend list (for invitation )only friends that not use the application.
My application at the following link
My Game application
visit it and see the problem exactly after inviting friends they will appear again is this normal in any game application?
thanks in advance for any reply
In FBML if you are using the friend-selector you can pass it an array exclude_ids. If you use the api to find the users' friends who are already using your app, you can exclude them this way.
This also works in the multi-friend-selector which sits inside an fb:request-form tag.
EDIT: the array of users to exclude can be obtained through the api call Friends.getAppUsers.
Following example uses the .NET Facebook Developer Toolkit. (mainly because that's how I've done it before!)
CODE BEHIND:
public string CURRENT_USER_FRIENDS = "";
//Call this function on pageload or where you like
private void PopulateFriendsData()
{
//exclude friends who already have the app from the inviter
string UsersToExclude = string.Empty;
IList<long> AppUserFriends = this.Master.API.friends.getAppUsers();
foreach (long L in AppUserFriends)
{
UsersToExclude += L.ToString() + ",";
}
CURRENT_USER_FRIENDS = UsersToExclude.TrimEnd(',');
}
PAGE:
<fb:multi-friend-selector
actiontext="Select the friends you want to invite"
rows="3"
exclude_ids="<%=CURRENT_USER_FRIENDS%>"/>