Twitter - Post a Tweet

How can I do that?

The Twitter SampleCode is not working!

Is there a way to do that using oAuth?

Thanks! [import]uid: 9482 topic_id: 15207 reply_id: 315207[/import]

Try this twitter tutorial :slight_smile: [import]uid: 52491 topic_id: 15207 reply_id: 56253[/import]

Peach,

When using your tutorial, the little Twitter box that comes up specifically says that the application cannot post tweets to your profile, and so it doesn’t work at all. [import]uid: 40538 topic_id: 15207 reply_id: 58655[/import]

Did you set the correct permissions in Twitter? This sounds as though you didn’t give the app the proper access permissions.

So yeah, set the wrong permissions, and no - it wont work at all.

Take a look at the app on Twitter, should be an easy fix :slight_smile: [import]uid: 52491 topic_id: 15207 reply_id: 58685[/import]

You know what, I even looked at that bit but ignored it! lol
Thanks Peach :slight_smile: [import]uid: 40538 topic_id: 15207 reply_id: 58698[/import]

No worries, it’s easy enough to do - I think I did it myself the first time, actually :wink: [import]uid: 52491 topic_id: 15207 reply_id: 58702[/import]

On Android the webpopup window shows and then closes quickly with this message in the logs:

{“error”:”Could not authenticate you.”, “request”:”\/1\/statuses\/update.json”}

I follow the tutorial, and even try the example in Corona. None of then works. (adroid or iPhone)

This tutorial looks promising, but I can not run for a mistake that happens all the time and I’m not able to observe the code where the problem is:

\twittertest\main.lua:61: attempt to concatenate upvalue ‘twitter_request_token’ (a nil value)

this token should be returned form oAuth library, or am I wrong?

[import]uid: 9133 topic_id: 15207 reply_id: 63842[/import]

try my sendSocial function.
it’s part of a game helper module I’m writing in the moment.
and I will probably release it soon…

It uses a trick I read somewhere in this forum:
you can send messages to twitter and facebook via the adress bar!
so you only need a webPopup and the right strings here and there.

http://twitter.com/intent/tweet?text=wheee  

see what happens if you open that link. it’s almost the same with facebook, although it needs some more info (url, icon etc.) - customize the lines 18 et seq.

urlEncode (line 13) is taken from rum.lua (http://www.monkeydeadstudios.com/rum.php)
you can alternatively use the simple line behind “or:” that is not extensively tested.

-----------------------------  
-- Send String to Social Network --  
----------------------------  
-- example: fin.sendSocial ( string, "twitter" )  
-- return: nothing  
-----------------  
  
fin.sendSocial = function (theMessage, theNetwork)  
 local theNetwork = theNetwork or "twitter" -- twitter is default  
 local webGroup = display.newGroup()  
 local message = theMessage or "NO TITLE..."  
 webGroup:toFront()  
 local theString = fin.urlEncode ( message ) -- or: string.gsub(message, "( )", "%%20")  
 if theNetwork == "twitter" then   
 native.showWebPopup(20, 20, display.contentWidth - 40, display.contentHeight - 90, "http://twitter.com/intent/tweet?text="..theString)  
 elseif theNetwork == "facebook" then  
  
 -- customize!  
 local redirectUri = "http://www.canupa.com/"  
 local fbLink = "http://www.canupa.com/products/"  
 local fbPic = "http://canupa.com/images/stories/canupa\_logo\_tm.jpg"  
 local fbName = "App Name"  
  
 native.showWebPopup(20, 20, display.contentWidth - 40, display.contentHeight - 90, "http://www.facebook.com/dialog/feed?display=touch&redirect\_uri="..redirectUri.."&link="..fbLink.."&picture="..fbPic.."&name="..fbName.."&description="..theString)  
 end  
  
 -- customize your back button...  
 local backBtn = display.newRect( webGroup, -30, -30, display.contentWidth+30, display.contentHeight+30 )  
 backBtn:setFillColor(0,0,0)  
 backBtn.alpha = 0.4  
 local btn\_touch = {}  
 local btn\_touch\_began = {}  
 function closeWebPopup()  
 webGroup.isVisible = false  
 native.cancelWebPopup()  
 end  
 function btn\_touch ( event )  
 if "began" == event.phase then   
 closeWebPopup()   
 end  
 end  
 backBtn:addEventListener ( "touch", btn\_touch )   
end  

hope that helps

-finefin

[import]uid: 70635 topic_id: 15207 reply_id: 63850[/import]