Chat Friends with Api

Hi there so basically I need to be able to message a friended user at specific times with a bot but I don’t know how to use it on netlify which is the static site i am doing it on and just anything about api any suggestions would be very appreciated. Thank you.

Update: Thanks to @majdTRM I found functions but it currently is not loading while using noblox.js

2 Likes

To send a message to a friend on Roblox using an API on the website netlify, you need to use the Roblox API to access the user’s friend list and send a message. You can do this by making HTTP requests to the Roblox API endpoints using a backend language like JavaScript, and hosting the code on Netlify.

Here’s an example of how you can send a message to a friend using JavaScript and the Axios library:

const axios = require('axios');

async function sendMessage(friendId, message) {
  try {
    const response = await axios.post(
      `https://api.roblox.com/users/${friendId}/friends`,
      {
        message: message
      },
      {
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${process.env.ROBLOX_API_KEY}`
        }
      }
    );
    console.log(response.data);
  } catch (error) {
    console.error(error);
  }
}

This code uses the Axios library to make a POST request to the Roblox API endpoint to send a message to a friend. The friendId and message parameters specify the recipient and message content, respectively. The ROBLOX_API_KEY in the Authorization header is the access token for the Roblox API, which you can obtain by following the steps in the Roblox Developer Hub.

You can host this code on Netlify by creating a new site, uploading the code to a Git repository, and connecting the repository to your Netlify site.

Note: To use the Roblox API, you need to have a Roblox developer account and be authorized by Roblox to use the API. Additionally, you should follow the Roblox API’s terms of use and respect the privacy of users.

1 Like

Use HTTPService. I don’t know a whole lot about HTTPService but I know that whatever you are trying to do is going to be used by that.

Why does that sound like you got it of chat gpt?

4 Likes

Bcuz they got it from there lmao

2 Likes

Maybe this is what you’re looking for? PrivateMessages Api (roblox.com)

Don’t forget to pass your security cookie, although on that note, you should be VERY careful with it.

Also, maybe it isn’t what you want. I believe this is the “Messages” feature like the Devex or builderman messages you get, not the chat api at the bottom of your page.

If you want the chat feature, take a look at this: chat.roblox.com/docs - /v2/send-message

yes it is the chat api I will change the title to better show that but I already knew about the docs because of local testing I just need a way to host it on the static web service netlify.

Perhaps you could look at running a scheduled task: Scheduled Functions | Netlify Docs

1 Like

Thanks will look into that charssssss

send a POST request to the API using this link https://chat.roblox.com/v2/send-message, response should be like this

{
  "message": "string",
  "isExperienceInvite": true,
  "userId": 0,
  "conversationId": 0,
  "decorators": [
    "string"
  ]
}

then put Content-Type as application/json

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.