Announcing Messaging Service API for Open Cloud

Even from other posts here, I still don’t understand how to send a JSON payload. It doesn’t seem to work as expected.

On Roblox, it would look like this, as expected:

MessagingService:PublishAsync("MyTopic", {hello = 32})
MessagingService:SubscribeAsync("MyTopic", function(msg)
   print("MESSAGE", HttpService:JSONEncode(msg)
end)
--> MESSAGE {"Sent": <timestamp>, "Data": {"hello": 32}}

But when I do the same thing from the Open Cloud API, it doesn’t work. If I leave the message payload as a JSON object, I get a 400 error. If I encode it as a string, it works, but the Lua code subscribing to the message does not decode it to a Lua table as expected.

For instance, I am sending the following payload via Postman:

{
    "message": "{\"hello\":32}"
}

And the response I get in my Lua topic subscription is:

--> MESSAGE {"Sent": <timestamp>, "Data": "{\"hello\": 32}"}

You see how the Data payload is wrapped in a string? It didn’t get parsed as expected. Maybe I’m doing something wrong? But I suspect this is a bug.

2 Likes

No.

What makes Open Cloud so amazing is that it will eventually allow you to directly interact with the Roblox API without needing a ROBLOSECURITY Cookie. It’ll all be done through API Keys.

Open Cloud also supports an API key-based access to help automate your internal workflows, and the ultimate goal is to improve your efficiency creating content on Roblox through an application ecosystem of tools and services.

Their goal is to eventually support all Web APIS with Open Cloud

What about for things such as currency api, that need to know the user?

Well, One of the two ways to create an API Key is to create it under a specific account, so I’m assuming that anyone using the API Key created under that specific account (and if the IP that’s being used is whitelisted) can interact with APIs that need to know the user.

1 Like

What was wrong with just using .ROBLOSECURITY cookie? (and, a little off-topic, but why isn’t it called .ROBLOXSECURITY instead?)

Edit: Is it because RobloSecurity expires?

Unreliable for many reasons. One of the major ones being this.

You can also whitelist only certain IP Addresses that are able to use the API Key. This is useful because if someone were to get a hold of your API Key, they wouldn’t be able to use it if they aren’t on the correct IP Address. :slight_smile:

You don’t have that advantage when using cookies.

No clue on that one.

1 Like

Isn’t that the same exact functionality? If someone tries the .RobloSecurity on a different IP than initially logged in with, it doesn’t let them? (Well besides that you can’t use it again.)


My guess is that maybe cookies have (or had) a character limit.

Oh so does this allow for things to happen externally when something is published with messaging service?

Well, when someone tries to login from a different IP Address with the cookie, it invalidates itself, making it useless.

With API Keys, that won’t happen. The API Keys will only work on the specified IP Addresses.

Hello everyone! I saw some of you find the tutorial/API docs hard to read so due to this I have made a tutorial based in node.js if anyone want to check it out. I have broken down the API in bits so it should be easy to understand.

1 Like

Really beautiful and detailed tutorial!
+kudos to you for taking your time with this, your tutorial will for sure help many people :smiley::+1:

1 Like

Sorry for bumping this thread, but had some issues regarding MessagingService. The SubscribeAsync function doesn’t respond at all. I tried debugging but nothing works. Can anybody tell how should I actually arrange my code (in roblox studio)?

I am not getting stuff to work, I get proper response and everything, but roblox does not seem to listen to requests at all.

Code in roblox:

messagingService:SubscribeAsync("among", function(msg) 
	print('test')
	print(msg.Data) 
end)

How i send requests:

const fetch = require("node-fetch")
async function s() {
    const res = await fetch(url, {
        method: "POST",
        headers: headers,
        body: {message: 'test'}
    })
    console.log(res)
}
s()

the URL looks like this: https://apis.roblox.com/messaging-service/v1/universes/4139112970/topics/among

(got it to work)

I am receiving code 500 (Internal Server Error) when trying to publish a message now. Is there a ongoing issue at the moment?

2 Likes

I am trying to use publish/save/publishTopic open cloud services provided by roblox. It use to work a few days ago, but recently it started to give me 500 internal errors… Not sure why, nothing has changed and was wondering if it was a roblox issue?

   [Symbol(kOutHeaders)]: [Object: null prototype] {
        accept: [ 'Accept', 'application/json, text/plain, */*' ],
        'content-type': [ 'Content-Type', 'application/json' ],
        'x-api-key': [
          'x-api-key',
          'my-actual-api-key-not-to-be-shared'
        ],
        'user-agent': [ 'User-Agent', 'axios/0.26.1' ],
        'content-length': [ 'Content-Length', 27 ],
        host: [ 'Host', 'apis.roblox.com' ]
      },
      [Symbol(kUniqueHeaders)]: null
    },
    data: { Error: 'Internal', Message: 'Failed to publish message.' }
  },
  isAxiosError: true,
  toJSON: [Function: toJSON]
}

The same happens with a curl command…

image

I am also having issues with it now, it was working before and now i am receiving the same error as you, i didn’t change anything for that to happen and i believe it was a Roblox change, it would be nice to hear what was changed.

1 Like

Your api key regenerated I believe.

Seems like message topic is working now, but for save and publish i am still getting 500 status response.

 data: {
      type: 'https://tools.ietf.org/html/rfc7231#section-6.6.1',
      title: 'An error occurred while processing your request.',
      status: 500,
      traceId: '00-e29fd8c94fcd0113c1bc9b7a39bd64b6-e19f9e3af3b53814-00'
    }

Any update regarding this issue? Seems I am still getting a 500 response

The issue is still persisting. Seems to work fine with an rbxlx file but not an rbxm. (using different commands for each)

$ curl --verbose --location --request POST 'https://apis.roblox.com/universes/v1/4092756726/places/11814862877/versions?versionType=Published' \
> --header 'x-api-key: not-to-share' \
> --header 'Content-Type: application/octet-stream' \
> --data-binary @./testrbx.rbxl
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 128.116.126.4:443...
* Connected to apis.roblox.com (128.116.126.4) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
*  CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
*  CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=*.roblox.com
*  start date: Jul 18 21:54:17 2022 GMT
*  expire date: Aug 13 22:53:34 2023 GMT
*  subjectAltName: host "apis.roblox.com" matched cert's "*.roblox.com"
*  issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certs.godaddy.com/repository/; CN=Go Daddy Secure Certificate Authority - G2
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* h2h3 [:method: POST]
* h2h3 [:path: /universes/v1/4092756726/places/11814862877/versions?versionType=Published]
* h2h3 [:scheme: https]
* h2h3 [:authority: apis.roblox.com]
* h2h3 [user-agent: curl/7.85.0]
* h2h3 [accept: */*]
* h2h3 [x-api-key: not-to-share]
* h2h3 [content-type: application/octet-stream]
* h2h3 [content-length: 0]
* Using Stream ID: 1 (easy handle 0x29d4e2202d0)
> POST /universes/v1/4092756726/places/11814862877/versions?versionType=Published HTTP/2
> Host: apis.roblox.com
> user-agent: curl/7.85.0
> accept: */*
> x-api-key: dont-share
> content-type: application/octet-stream
> content-length: 0
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 500 
< content-length: 200
< content-type: application/json; charset=utf-8
< date: Tue, 20 Dec 2022 20:51:27 GMT
< server: envoy
< strict-transport-security: max-age=3600
< x-envoy-upstream-service-time: 12
< report-to: {"group":"network-errors","max_age":604800,"endpoints":[{"url":"https://ncs.roblox.com/upload"}]}
< nel: {"report_to":"network-errors","max_age":604800,"success_fraction":0.001,"failure_fraction":1}
<
{"type":"https://tools.ietf.org/html/rfc7231#section-6.6.1","title":"An error occurred while processing your request.","status":500,"traceId":"00-083e609655c805bf633f48e8cacb1278-ae529ea59117521d-00"}* Connection #0 to host apis.roblox.com left intact