pesto-students/batch-11-relayer

View on GitHub
server/thirdparty/lib/slackLib.js

Summary

Maintainability
A
0 mins
Test Coverage
import makeRequest from '../../lib/requestLib';


module.exports.postMessage = async (options) => {
  console.log(options)
  const requestOptions = {
    url: 'https://slack.com/api/chat.postMessage',
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    form: {
      text:options.text,
      channel:options.channel,
      token:options.token,
    },
  };
  //console.log(requestOptions)
  const response = await makeRequest(requestOptions);
  return response;
};