Search code examples
node.jsrequeststeam

Node post request on steam


I am trying to create script that could post comment in my thread on steam with node and request lib. Trying to achieve by doing something like this:

const body = {
  comment: 'Sometext',
  count: '15',
  sessionid: session_id,
}
bumpingDiscussionsPostsModule.bumpInDiscussion=async() => {
  const postHeader = {
    method: 'POST',
    uri: urlPost,
    headers: {
      Cookie: cookie
    },
    form: JSON.stringify(body)
  }
  const response = await request(postHeader);
  console.log(response);
}

Tho steam keeps returning me returning {"success":false}, any clues what I am doing wrong?


Solution

  • I was just formatting it wrong. If someone might be looking for it, this gets the job done:

    const doBump = await fetch(bumpingUri, {
        method: 'post',
        body: `comment=${process.env.BUMP_COMMENT}&count=15&sessionid=${process.env.CONN_SESID}&extended_data=${process.env.EXTENDED_DATA}&feature2=${featureID}oldestfirst=true&include_raw=true`,
        headers: {
         'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
         'accept': 'text/javascript, text/html, application/xml, text/xml, */*',
          Cookie: process.env.CONN_STRING
        }
      });