If you have not done so already, register an application here: http://www.twitch.tv/settings/connections, for your redirect url use http://localhost/, you will need your client id to request an oath token (which this script can retrieve by itself). Utilize the right click menu (from your channel) to input the client id of your application and then to request the token. If you have a separate account running a bot you should register the application under your bot, and then login as your normal user in order to request the token.

Dependencies:
$json: http://www.mircscripts.org/comments.php?cid=4407
SSL: http://www.mirc.com/ssl.html

Source: https://gist.github.com/memnochxx/5676bef5707a8019f0ca

In general you'll create an alias to open the socket and a signal to handle the response. I've just created these to allow you to follow a channel. Changing the current game uses the same call as the topic, so check that section out to use as a template.

You may come across scopes that the script currently does not request. Just add it to scope_request in twitch.ini and request/renew your token.