App42 platform is now equipped with the power of Buddy Management APIs using which developers can have their own Social Network platform in their apps.
Using Buddy Management, one can equip the app with the following features:
- Send/Accept/Reject friend request
- Create custom group of friends like best friends, college friends etc.
- Add/Remove friends from custom groups
- Send private message to a friend
- Send message to groups
- Share file with friends
- Share file with groups
- Checked In location for friends
- Geo location search for friends
- And many more
Below mentioned are the steps to get started with App42 Buddy Management using JavaScript SDK:
- Register with App42 platform
- Create an app once you are on the Quick-start page after registration.
- If you are already registered, login to AppHQ console and create an app from App Manager–>App Create link.
- Once the App is created, you will get an ApiKey/SecretKey that you will use in your app for initialization of SDK.
- Download JS Sample Application
Here are the few API highlights used inside the sample application:
Sending Friend Request
var sender= "Nick",
buddyName = "John",
message = "Please accept my friend request.",
result ;
buddyService.sendFriendRequest(sender, buddyName, message,{
success: function(object) {
var buddyObj = JSON.parse(object);
result = buddyObj.app42.response.buddies.buddy;
console.log("userName is " + result.userName)
console.log("buddyName is " + result.buddyName)
},
error: function(error) {
}
});
Get Friend Request.
var result,
userName = "Nick";
buddyService.getFriendRequest(userName,{
success: function(object) {
var buddyObj = JSON.parse(object);
result = buddyObj.app42.response.buddies.buddy;
console.log("result is " + result)
},
error: function(error) {
}
});
Accept Friend Request
var userName = "Nick",
buddyName = "John",
result ;
buddyService.acceptFriendRequest(userName, buddyName,{
success: function(object){
var buddyObj = JSON.parse(object);
result = buddyObj.app42.response.buddies.buddy;
console.log("userName is " + result.userName)
console.log("buddyName is " + result.buddyName)
},
error: function(error) {
}
});
Reject Friend Request
var userName = "Nick",
buddyName = "John",
result ;
buddyService.rejectFriendRequest(userName, buddyName,{
success: function(object){
var buddyObj = JSON.parse(object);
result = buddyObj.app42.response.buddies.buddy;
console.log("userName is " + result.userName)
console.log("buddyName is " + result.buddyName)
},
error: function(error) {
}
});
Create Group For Friends
var userName = "Nick",
groupName = "groupName",
result ;
buddyService.createGroupByUser(userName, groupName,{
success: function(object){
var buddyObj = JSON.parse(object);
result = buddyObj.app42.response.buddies.buddy;
console.log("userName is " + result.userName)
console.log("buddyName is " + result.buddyName)
},
error: function(error) {
}
});
Manage Your Friends In Group
var result,
userName = "Nick",
groupName = "groupName";
var friendList = new Array();
friendList.push("John")
buddyService.addFriendToGroup(userName,groupName,friendList,{
success: function(object){
var buddyObj = JSON.parse(object);
result = buddyObj.app42.response.buddies.buddy;
console.log("result is " + result)
},
error: function(error) {
}
});
Share Message To Your Friends
var userName = "Nick",
message = "Welcome to Shephertz",
result ;
buddyService.sendMessageToFriends(userName,message,{
success: function(object){
var buddyObj = JSON.parse(object);
result = buddyObj.app42.response.buddies.buddy;
console.log("userName is " + result.userName)
},
error: function(error) {
}
});
Share File To Your Friends
var upload = new App42Upload();
var name = "name";
var userName = "userName" ;
var filePath = document.getElementById("Your input type file id");
var file = filePath.files[0];
var description = "description";
upload.uploadFileForFriends(name,userName,file,"IMAGE",description,{
success: function(object) {
console.log(" i am in success"+ object);
},
error: function(error) {
console.log( " i am in error"+ error);
}
});
Send Private Massages To Your Friend
Ones users become a friends they would be able to send private messages to each other.
var userName = "Nick",
buddyName = "John",
message = "Welcome to Shephertz",
result ;
buddyService.sendMessageToFriend(userName,buddyName,message,{
success: function(object){
var buddyObj = JSON.parse(object);
result = buddyObj.app42.response.buddies.buddy;
console.log("userName is " + result.userName)
},
error: function(error) {
}
});
Checked In To Geo Location
var userName = "Nick",result ;
var point={
lat:-73.99171,
lng:40.738868,
marker: "My Current Location"
};
buddyService.checkedInGeoLocation(userName,point,{
success: function(object){
var buddyObj = JSON.parse(object);
result = buddyObj.app42.response.buddies.buddy;
},
error: function(error) {
}
});
var userName = "Nick",
lat = -73.99171 ,
lng = 40.738868,
maxDistance = 10,//in km
maxresult = 5,
result ;
buddyService.getFriendsByLocation(userName,lat,lng,maxDistance,maxresult,{
success: function(object){
var buddyObj = JSON.parse(object);
result = buddyObj.app42.response.buddies.buddy;
},
error: function(error) {
}
});
Visit our Buddy Management landing page to learn more and to get started. Please share your feedback with us at support@shephertz.com
Leave A Reply