Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Scratch Messages API
- kvackkvack
-
Scratcher
500+ posts
Scratch Messages API
Quite long ago now, I made a JavaScript API . Looking back at it now, I say one thing with certainty: It sucked. Like, it didn't even work for all types of messages, and it was clunky to use with bad documentation and bad code.
To redeem myself, I've made another, similar API– this time with classes, proper documentation, as much browser support as I could get in there and a minified version.
If anybody would be interested in using it, the code is here. Personally, I think it's pretty great, but there's definitely room for improvement! If you spot some bad code or want to add a new feature, feel free to submit a pull request. There's a Wiki article for Developers on there.
To redeem myself, I've made another, similar API– this time with classes, proper documentation, as much browser support as I could get in there and a minified version.
If anybody would be interested in using it, the code is here. Personally, I think it's pretty great, but there's definitely room for improvement! If you spot some bad code or want to add a new feature, feel free to submit a pull request. There's a Wiki article for Developers on there.

- kvackkvack
-
Scratcher
500+ posts
Scratch Messages API
BUMP.
I just added message filtering and an ability to specify wait time between HTTP requests.
Here's an example script which gets your 15 most recent follows (with modern JS):
Note that the long wait times are due to it possibly having to crawl through multiple messages pages, to decrease this time change the time attribute.
I just added message filtering and an ability to specify wait time between HTTP requests.
Here's an example script which gets your 15 most recent follows (with modern JS):
getMessages({ filter: msg => msg.type === ScratchMessage.TYPE.FOLLOWED, limit: 15, time: 2000 }, (error, messages) => { if(error) error.call() messages.forEach(message => console.log('At ' + message.date + ': ' + message) ) })
- Discussion Forums
- » Advanced Topics
-
» Scratch Messages API