This is how you’d do it with the JS SDK. Just make sure you’re using the version on github and not the CDN hosted one.
Twitch.api({
method: 'users/' + user.name + '/follows/channels/' + channel,
verb: 'PUT'
}, function (error, data) {
// ...
});