First off got to say, awesome plugin. Helped us solve something we were stuck with for hours in just a few minutes! But got a question, what should the object_type param contain in order to post the dynamic stories? Thanks!
Edit: Just gave carrot.postAction(‘actionID’, ‘objectID’) a try and that works, using the same code given by the website. But as soon as I try change the code to a dynamic post, it’s not working for some reason. Not sure what’s wrong.
This is our current code:
carrot.postAction('complete', nil, nil, {object\_type='level\_'..level, title='Some title stuff that is about this long right now', description='I just reached level '..level..'.', image\_url='\<imgurl\>'})
Not sure what could be messing about? Guessing it’s the object_type param but not sure what we’re supposed to fill in there?
Alright, so I tried changing it to level and ended up with this code, but it’s still not posting:
carrot.postAction('complete', nil, nil, {object\_type='level', title='Some title stuff that is about this long right now', description='I just reached level '..level..'.', image\_url='\<imgurl\>'})
On our Carrot page, our unique id is “level” and the code we get from the “Code” button for Corona SDK is carrot.postAction(“complete”, “level”).
I see, the title at the top of the page says “Levels” but the url says “level”. I’ll try use both Levels and levels as the object_type now and see if that works.
Yeah that’s the page I’m double checking against and nothing has popped up there thus far.
Edit: Just tested ‘levels’ but it once again didn’t post anything. This is truly strange because it works perfectly when we use the normal carrot.postAction(action, object) code.
Ah, is this needed for all apps? Or should there be a button that we must click to enable the dynamic posts? Fired you the app id over pm Thanks again for all the help.
carrot.postAction("ACTION\_ID", nil, nil, { object\_type = "OBJECT\_TYPE", title = "New Object Title", description = "New Object Description", template = "TEMPLATE\_ID", image\_url = "http://placekitten.com/512/512"})
And that new parameter ‘template’ needs to be the identifier of the instance that you said “Use as Template”.
Then in the web-tool, put “{{title}}” for the title, “{{description}}” for the description etc.
You can also add more data and such, so for example the description in the web tool could be: “I just reached level {{level}}!” and you would pass along level = “5” in the call, if that makes sense.
Hmm nope, still nothing, using this code right now:
carrot.postAction('complete', nil, nil, {object\_type='level', template='level', title='Some title stuff that is about this long right now', description='I just reached level '..level..'.', image\_url='\<imgurl\>'})
And the template value being the unique id of the instance I created inside “Levels”. The value that is preceded by a ‘#’ in the web-tool. But still using this it’s not posting for some reason.
Edit: Also added {{title}} and {{description}} as the web-tool’s title and description but no success…
Edit2: Tried changing the template id to be different from the object_type value but no success there either… It’s really strange since everything otherwise works just fine…
Ah I totally did that wrong. Sorry, hard to keep the SDKs all in my head (re-write is in progress to standardize them)
It should look like this:
carrot.postAction('complete','level', nil, { title = "New Object Title", description = "New Object Description", image\_url = "http://placekitten.com/512/512"})
This makes it similar to a standard ‘postAction’ only passing along the data for the template.
It’s possible that it will give an error “objectProperties must contain an entry for ‘object_type’.” and if that’s the case, simply put in a dummy value for ‘object_type’.
Edit: UGH finally!! The last issue seems to have been on my end where I for some reason had swapped the carrot app secret with the app key in the carrot.init() call. Switched it back now and using the last sample quoted in this post it works like a charm! Thanks a lot again for the help!!
First off got to say, awesome plugin. Helped us solve something we were stuck with for hours in just a few minutes! But got a question, what should the object_type param contain in order to post the dynamic stories? Thanks!
Edit: Just gave carrot.postAction(‘actionID’, ‘objectID’) a try and that works, using the same code given by the website. But as soon as I try change the code to a dynamic post, it’s not working for some reason. Not sure what’s wrong.
This is our current code:
carrot.postAction('complete', nil, nil, {object\_type='level\_'..level, title='Some title stuff that is about this long right now', description='I just reached level '..level..'.', image\_url='\<imgurl\>'})
Not sure what could be messing about? Guessing it’s the object_type param but not sure what we’re supposed to fill in there?