Announcing Messaging Service API for Open Cloud

I keep on getting “Request body not in correct format.” 400
what am i doing wrong??

header = {
'x-api-key':apikey,
'Content-Type':'application/json'}
url = 'https://apis.roblox.com/messaging-service/v1/universes/{}/topics/{}'.format(universeid,topic)
tosend =   {
    "message":'hi'
}
response = requests.post(url,data=tosend,headers=header)
print('>>sent! ', response.text,response.status_code)
1 Like

Is there any way to run sent messages through the chat filter?

1 Like

I would try json=tosend instead of data=tosend

1 Like

You can try using TextService on the receipt handler in SubscribeAsync

1 Like

I am still very much looking forward to trying Open Cloud one day. All this functionality sounds great.

Our game (aka universe) doesn’t appear in search when trying to set Place Permissions for an API key. This affects any API System including DataStore, Messaging Service and Place Publishing.

Does anyone know why?

We have other games (like Dev/Beta environments) that will show up in search. It’s only our main public game that doesn’t appear.

You may think it’s to do with the use of Emoji, but I have even tried removing the emoji to no avail.

Like a few people upthread, I’m also only getting 400 Bad Request when trying to set the message field to a json object. It works as expected when message is a string, number, or bool.

It isn’t clear if this is intended but it isn’t mentioned in the documentation.

Example curl commands:

curl -v \
	--location --request POST 'https://apis.roblox.com/messaging-service/v1/universes/3729025203/topics/{topic}' \
--header 'x-api-key: hunter2' \
--header 'Content-Type: application/json' \
--data-raw '{"message":"This gets a 200"}'
curl -v \
	--location --request POST 'https://apis.roblox.com/messaging-service/v1/universes/3729025203/topics/{topic}' \
--header 'x-api-key: hunter2' \
--header 'Content-Type: application/json' \
--data-raw '{"message":{"a":"This gets a 400"}}'
2 Likes

So I’m guessing that I would have to JSONDecode it then? Which means i’d have to add logic to the Subscribed message checking to see if the data is a string then decode it. :\

1 Like

The actual message requires to be a JSON encoded string. In your case, it would look something like

--data-raw '{"message":"{\"a\":\"This gets a 400\"}}"}'

Ah, I didn’t realize it had to be string because it also accepts numbers and bools, but looking closer it seems like those get converted to strings before actually reaching the game server.

I would suggest putting that somewhere prominent in the documentation. I expected this to follow the ‘normal’ rules about what can be serialized for DataStores, RemoteEvents, etc and I’m surprised to see this has different restrictions.

2 Likes

If you are sending a simple string, you don’t need to have decode logic on the subscriber.
For example, if you are sending a simple string as:

--data-raw '{"message":"message to publish"}'

Subscriber will only receive "message to publish"

The body data must be stringified JSON

Is there any way to confirm if a server has received a request using this?
As far as I can see the best way would be for the game server to send a http request telling your external system the message was received if you need this confirmation.

You’re just gonna have to believe it.

This seems like a sponsored ad lol…

2 Likes

I love this new feature! One thing I’d love to see would be the ability to publish a place to another place and then shutdown the servers of said place as well as the ability to update packages in a place.

Our update workflow relies on separate testing places which are essentially copies of their live counterparts and it is such a pain to open 5 different places, update all the packages in those places, publish them and then publish them again to the live counterparts.

Thanks for this!

Our service can now no longer have to manage painful user API keys and can just directly interact with Roblox’s API for some of my features.

Unfortunately, some of the features that we plan to provide need to be permanent so the DataStore API or internal requests to our API/database might be a better fit for the majority of our planned features.

Still, kudos!

It isn’t as insecure as you might think, the endpoint would still have to be authenticated against. Websockets work by making an initial http request to the endpoint, the server then upgrades the request into a websocket at which point a two way connection will be initialized. All this traffic will then be sent back and forth over a secure channel without much way to intercept it.
So it’s not possible for random people to listen into your MessagingService for your game (unless your API key is exposed)

This is the point you can now receive messages from external servers in the same way you would do with a normal MessagingService system among roblox servers

You need to read more carefully. He’s asking if external servers can receive a subscribing api point in the same way games can.

I should mention that my comment on websockets is Roblox’s stance, not my own: Web Sockets for servers - #5 by Silent137