lib/controllers/slack/botkit/slack_web_api.js
function postForm(url, formData, cb, multipart) {
        cb = cb || noop;

        bot.logger.info('** API CALL: ' + url);
        var params = {
            url: url,
            headers: {
                'User-Agent': bot.userAgent(),
            }
        };

        if (multipart === true) {
            params.formData = formData;
        } else {
            params.form = formData;
        }

        request.post(params, function(error, response, body) {
            bot.logger.debug('Got response', error, body);

            if (error) {
                return cb(error);
            }

            if (response.statusCode == 200) {
                var json;
                try {
                    json = JSON.parse(body);
                } catch (parseError) {
                    return cb(parseError);
                }

                return cb((json.ok ? null : json.error), json);
            } else if (response.statusCode == 429) {
                return cb(new Error('Rate limit exceeded'));
            } else {
                return cb(new Error('Invalid response'));
            }
        });
    }
function postForm(url, formData, cb, multipart) {
        cb = cb || noop;

        bot.logger.info('** API CALL: ' + url);
        var params = {
            url: url,
            headers: {
                'User-Agent': bot.userAgent(),
            }
        };

        if (multipart === true) {
            params.formData = formData;
        } else {
            params.form = formData;
        }

        request.post(params, function(error, response, body) {
            bot.logger.debug('Got response', error, body);

            if (error) {
                return cb(error);
            }

            if (response.statusCode == 200) {
                var json;
                try {
                    json = JSON.parse(body);
                } catch (parseError) {
                    return cb(parseError);
                }

                return cb((json.ok ? null : json.error), json);
            } else if (response.statusCode == 429) {
                return cb(new Error('Rate limit exceeded'));
            } else {
                return cb(new Error('Invalid response'));
            }
        });
    }
function postForm ( url , formData , cb , multipart ) { cb = cb || noop ; bot . logger . info ( '** API CALL: ' + url ) ; var params = { url : url , headers : { 'User-Agent' : bot . userAgent ( ) , } } ; if ( multipart === true ) { params . formData = formData ; } else { params . form = formData ; } request . post ( params , function ( error , response , body ) { bot . logger . debug ( 'Got response' , error , body ) ; if ( error ) { return cb ( error ) ; } if ( response . statusCode == 200 ) { var json ; try { json = JSON . parse ( body ) ; } catch ( parseError ) { return cb ( parseError ) ; } return cb ( ( json . ok ? null : json . error ) , json ) ; } else if ( response . statusCode == 429 ) { return cb ( new Error ( 'Rate limit exceeded' ) ) ; } else { return cb ( new Error ( 'Invalid response' ) ) ; } } ) ; }
Makes a POST request as a form to the given url with the options as data

@param {string} url The URL to POST to
@param {Object} formData The data to POST as a form
@param {function=} cb An optional NodeJS style callback when the POST completes or errors out.
Makes a POST request as a form to the given url with the options as data