我每天都想運行一個耙子任務,將更新發布到應用程序的Facebook頁面。該頁面在Facebook>應用程序>設置>高級(在底部)下定義。使用應用程序令牌在頁面中發佈應用程序頁面?考拉
我想獲取應用訪問令牌,然後作爲頁面發佈到頁面。這是什麼樣的,我想,但它不工作:
@oauth = Koala::Facebook::OAuth.new(CONFIG['appid'], CONFIG['appsecret'])
@token = @oauth.get_app_access_token
@page_graph = Koala::Facebook::API.new(@token)
@page_graph.put_connections('NAME_OF_PAGE','feed', :message => 'This is posted as the page')
的錯誤,我得到:
OAuthException: (#200) The user hasn't authorized the application to perform this action
我不知道是否有一個地方(我試過路過如在@ oauth.get_app_access_token一個選項):
@ oauth.get_app_access_token(:權限=> 「manage_pages」)
還是什麼都沒有。有任何想法嗎?
[更新]
所以我改成:
@oauth = Koala::Facebook::OAuth.new(CONFIG['appid'], CONFIG['appsecret'])
@token = @oauth.get_app_access_token
@page_graph = Koala::Facebook::API.new(@token)
@postid = @page_graph.put_connections(CONFIG['appid'],'feed', :message => 'This is posted as the page')
後來,當我輸出@postid,我得到一個有效的身份證件。我把這個ID放在:https://graph.facebook.com/POSTID,我得到了一個有效的回覆。
這是超級混亂。爲什麼它沒有出現在頁面上?
@ page_graph.put_connections(CONFIG [「APPID」],「喂」,:消息=>「這是張貼在網頁」) 沒有給出錯誤,但它仍然沒有發佈到飼料 – Marc