 createAccount = ({id, nickname}, callback)->
   if not id or not nickname
     return callback {message:"Request is not valid for creating account"}
-  url = "/account"
+  url = "#{socialProxyUrl}/account"
   post url, {oldId: id, nick: nickname}, callback
 
 updateAccount = (data, callback)->
   {id, nick} = data
   if not id or not nick
     return callback {message:"Request is not valid for updating account"}
-  url = "/account/#{id}"
+  url = "#{socialProxyUrl}/account/#{id}"
   post url, data , callback
 
 createChannel = (data, callback)->
   unless data.name or data.creatorId
     return callback { message: "Request is not valid for creating channel"}
-  url = "/channel"
+  url = "#{socialProxyUrl}/channel"
   post url, data, callback
 
 fetchChannelActivities = (data, callback)->
   if not data.channelId or not data.accountId
     return callback { message: "Request is not valid for fetching activities"}
-  url = "/channel/#{data.channelId}/history"
+  url = "#{socialProxyUrl}/channel/#{data.channelId}/history"
   get url, data, callback
 
 fetchActivityCount = (data, callback)->
   if not data.channelId
     return callback {message: "Request is not valid for fetching activity count"}
 
-  url = "/channel/#{data.channelId}/history/count"
+  url = "#{socialProxyUrl}/channel/#{data.channelId}/history/count"
   get url, data, callback
 
 fetchGroupChannels = (data, callback)->

  unless data.id
    return callback { message: "Request is not valid for listing actors" }

  url = "/message/#{data.id}/interaction/like"
  delete data.id
  get url, data, callback


  if not data.accountId or not data.body or not data.messageId
    return callback { message: "Request is not valid for adding a reply"}

  url = "#{socialProxyUrl}/message/#{data.messageId}/reply"
  post url, data, callback

listReplies = (data, callback)->
  unless data.messageId
    return callback { message: "Request is not valid for adding a reply"}

  url = "#{socialProxyUrl}/message/#{data.messageId}/reply"
  get url, data, callback

fetchPopularTopics = (data, callback)->
  if not data.groupName or not data.type
    return callback {message: "Request is not valid for listing popular topics"}

  url = "#{socialProxyUrl}/popular/topics/#{data.type}"
  get url, data, callback

fetchPopularPosts = (data, callback)->
  if not data.groupName or not data.channelName
    return callback {message: "Request is not valid for listing popular topics"}

  url = "#{socialProxyUrl}/popular/posts/#{data.channelName}"
  get url, data, callback

fetchPinnedMessages = (data, callback)->
  url = "#{socialProxyUrl}/activity/pin/list"
  get url, data, callback

pinMessage = (data, callback)->
  if not data.accountId or not data.messageId or not data.groupName
    return callback { message: "Request is not valid"}

  url = "#{socialProxyUrl}/activity/pin/add"
  post url, data, callback

unpinMessage = (data, callback)->
  if not data.accountId or not data.messageId or not data.groupName
    return callback { message: "Request is not valid"}

  url = "#{socialProxyUrl}/activity/pin/remove"
  post url, data, callback

glancePinnedPost = (data, callback)->
  if not data.accountId or not data.messageId or not data.groupName
    return callback { message: "Request is not valid"}

  url = "#{socialProxyUrl}/activity/pin/glance"
  post url, data, callback

glanceNotifications = (data, callback)->
  if not data.accountId
    return callback { message: "Request is not valid"}

  url = "#{socialProxyUrl}/notification/glance"
  post url, data, callback

listNotifications = (data, callback)->
  if not data.accountId # or not data.groupName
    return callback {message: "Request is not valid"}

  url = "#{socialProxyUrl}/notification/#{data.accountId}"
  get url, data, callback

listParticipants = (data, callback)->
  return callback { message: "Request is not valid" } unless data.channelId
  url = "#{socialProxyUrl}/channel/#{data.channelId}/participants"
  get url, data, callback

addParticipants = (data, callback)->
  url = "#{socialProxyUrl}/channel/#{data.channelId}/participants/add"
  doChannelParticipantOperation data, url, callback

removeParticipants = (data, callback)->
  url = "#{socialProxyUrl}/channel/#{data.channelId}/participants/remove"

  {channelId, accountId} = data
  # fetch channel details
