Messaging Service: 'Resources not authorized.'

Roblox Messaging Service Issue - Node.js Integration

1. What do you want to achieve?

I want to use the Roblox Messaging Service to send a request from a Node.js script to my Roblox game.


2. What is the issue?

When sending a request to Roblox using the correct API key and format, I receive the following error:

{ code: 7, message: 'Resources not authorized.', details: [] }

3. What solutions have you tried so far?

  • Generated a new API key.
  • Uploaded a new game and tested there.
  • Reviewed documentation on the Roblox Creator Hub.
  • Tried seeking help from AI.

Roblox Server Script

local MessagingService = game:GetService("MessagingService")

local function onMessageReceived(message)
	print("Received message:")
	print(message.Data)
end

print("Subscribed to topic: bot")

MessagingService:SubscribeAsync("bot", onMessageReceived)

Nodejs Script

const axios = require('axios');

const universeId = '128869192558631';
const apiKey = "";
const topic = 'bot';
const message = 'Hello, world!';

const url = `https://apis.roblox.com/cloud/v2/universes/${universeId}:publishMessage`;

const payload = {
  topic: topic,
  message: message
};

// Send the POST request
axios.post(url, payload, {
  headers: {
    'x-api-key': apiKey,
    'Content-Type': 'application/json'
  }
})
.then(response => {
  console.log('Message published successfully:', response.data);
})
.catch(error => {
  console.error('Failed to publish message:', error.response?.data || error.message);
});

I believe that the issue originates from your universeId - it seems that the id you put is the place id, rather than the universe id.

The actual universe id that you should put is 8040540779 (assuming my way of getting the universe id was accurate).

I just did this before you responded to me and it works tbh it was my fault :sob:

It’s an easy mistake to make, so don’t feel bad about it!

1 Like

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