Introducing Embedded Messaging Service (EMS)! | Multi-server and multi-game communication with a web api!

GENERATE YOUR KEY HERE https://EMS.usernamewitheld.repl.co
VIEW UPTIME HERE EMS if all 5 monitors say offline, only then should you contact me.
GET THE MODULE HERE EMS - Roblox
VIEW EXAMPLE CODE HERE https://gist.github.com/Embedded77/9ef68aa8712f5ecf88a24da6aec1ee2a

What is EMS?

EMS is a variation of MessagingService created by me. It features a multitude of incredibly useful methods which I found people needed.

What purpose does this serve?
EMS was created to allow for cross-game messaging. It features connecting webhooks to channels as well as all of the standard messaging service functions. You can also recall old messages, which are saved to a unique id.

Will this greatly impact performance?
Not noticeably. I actually created a whole roblox discord client using it, game ran buttery smooth.

How do I use it?

How to use specific methods is documented below.
You must first visit my website to generate your unique token. This token should not be shared with anyone except for the developers of your game. This token can be reset at any time.
You may get the module here

Is it secure?
Your security is a major priority in this project and I strive to improve it any way I can. All of the fields passed to us are encrypted, excluding the timestamp and channel name.
You may erase any of your messages at any time from our records by simply deactivating your token, or erasing single messages.

What if your web server is down?
I’m almost done implementing a retrial system in the rare event my web server is offline for a few seconds or more.

Please feel free to ask any more questions by replying to this topic.

Documentation

EMS.new(apiToken)

This function creates a new EMS instance.

Parameters:
apiToken: string – the api token you received when registering on our site.

Returns:
EMS: object – the EMS object you can now use with the other methods.

Example:

EMService=require(game.ServerStorage.EMS)
local ems=EMService.new("myveryveryrealandnotfaketoken")

EMS:Subscribe(channelID,onMessage)

This function subscribes this server to the specified channel.

Parameters:
channelID: string – the id of the channel you want to handle the messages on
onMessage: function --the function you want to be called when there’s a new message
Returns:
nil

Example:

ems:Subscribe("Notifications",function(message)
print(message)--{author="serverid",content="messagecontent",timestamp="12345678",messageID:1234}
end)

EMS:RemoveSubscription(channelID)

This function removes any subscriptions this server has to the specified channel.

Parameters:
channelID: string – the id of the channel you want to remove the handler for
Returns:
nil

Example:

ems:RemoveSubscription("Notifications")

EMS:ConnectWebhook(channelID,webhookURL)

This function sends a POST request to the specific webhook url when a message is received

Parameters:
channelID: string – the id of the channel you want to monitor
webhookURL: string– the url of the webhook you want it to send a request to.

Returns:
nil

Example:

ems:ConnectWebhook("Notifications","CoolWebhook1234")

EMS:RemoveWebhookConnection(channelID)

This function removes any webhook connections this server has to the specified channel.

Parameters:
channelID: string – the id of the channel you want to remove the connection for
Returns:
nil

Example:

ems:RemoveWebhookConnection("Notifications")

EMS:ValidateToken()

This function validates the token of the current EMS object.

Parameters:
none
Returns:
result: boolean – whether the token is valid or not.

Example:

ems:ValidateToken()

EMS:Post(channelID,content)

This function validates the token of the current EMS object.

Parameters:
channelID: string – the channel you want to send the message to
content: string – the content of the message you want to send

discordData: object – the discord webhook data.
Returns:
result: object – whether the message was sent or not

Example:

ems:Post("Notifications","Hi",{
			content = content;
			username = "EMS";
			avatar_url = "https://catfriendly.com/wp-content/uploads/2019/06/AdobeStock_53119595.jpeg"
		})

EMS:FetchContent(messageID)

This function fetches the content of the message with the specified id.

Parameters:
messageID: integer – the id of the message you want to fetch
Returns:
result: table – This function will return nil if the messageID is invalid or your token is not authorized to view it.

Example:

ems:FetchContent(1234) -- {author="serverid",content="messagecontent",timestamp="12345678",messageID=1234}

EMS:Delete(messageID)

This function deleted the message with the specified id.

Parameters:
messageID: integer – the id of the message you want to delete.
Returns:
result: boolean – whether it was deleted

Example:

ems:Delete(1234) -- true

EMS:Begin(messageID)

Begin the EMS Handler

Parameters:
interval: integer – the intervals which it should scan for new messages

Returns:
function – the coroutine which you may run in order to start up ems

Example:

ems:Begin(1)()

Web Docs

GET fetch_message_packet

Query:
timestamp – The timestamp you want messages from
key – the key you generated


POST new_message

Headers:
token
timestamp
author
channel
content


GET fetch_archived_message

Query:
key
messageid


POST erase_message

Query:
key
Headers
messageid


Contact

Questions? Concerns?
You can contact me here:

Embedded77#1367

22 Likes

More features coming soon, if you have any ideas dm me them.

3 Likes

I gotta be honest, this sounds a lot more complex than normal MessagingService with no additional features.

With this I have to:

generate a token
create
begin
validate
fetch
post

With MessagingService I just:
assign
subscribe
post

What’s the benefit of using this?

6 Likes

you can use this to interact with msgsrv from outside of Roblox without having to write your own wrapper for fetching, distributing and sending messages between services

2 Likes

with no additional features.

I’m sorry, what? MessagingService only lets you talk to servers in between the same game. This service allows any game to talk to any other game, regardless of ownership. This is absolutely HUGE. This is massive in terms of additional features!

5 Likes

I love the idea of this, I might actually use this since I’m working on very backend heavy code utilizing messaging services and a lot of HTTPService work. I have just one question: Is there by any chance a way for us to integrate backend services of our own on top of the EMS backbone?

2 Likes

The structure for a web api is already there, I’ll get to writing one later today and link it here when I’m done.

1 Like

Hey, I’m adding more stuff to ems, itll be down for abt an hr or so. Sorry for the downtime
Downtime over, systems back online.

1 Like

This needs better documentation then. It’s nearly impossible to read anything in this article, it’s too confusing to an outsider.

While it may be a good additional feature, it’s the only one.

I intended for this documentation to be easy to read for anyone with basic English comprehension. From what I see, you’re the only one struggling to understand it. Reading your past message, you likely did not even read the whole thing.

2 Likes

Some functions are easy to understand but I don’t know how to put them together. You should have an example script somewhere.

For example, begin. What does that do? Reading the documentation:

:neutral_face:
That’s helpful.

If I’m creating a new instance of this thing why would I need to begin?

Now all of these questions could be cleared up with a good code snippet but all you wrote is one line.

This is much better documented:

Edit: Looks like I’m not even the only one struggling to understand it. I know the feeling; it makes perfect sense to you but some people don’t understand it. To help, look at the module as if you had no idea what it even did at all.

This sounds interesting and can be useful if implemented properly; However, an example script may be more helpful for figuring out the API than miniature snippets and descriptions.

1 Like

Added web docs, all endpoints use the base url of https://EMS.usernamewitheld.repl.co/

by the way i crashed the repl project by not including the timestamp

you should make it so you dont have to include the header. if someone doesnt provide the header just get the current unix time and use that

Ah, hadn’t updated the repl. It’s now fixed. Thanks for telling me.

Can you make an example code or a GItHub explaining? This seems very useful for my next project.

Sure, give me a few days, and I’ll get an example game people can clone and stuff.

Improved the efficiency of the backend, you should be seeing a definite improvement in performance.

Hey uh…

Every time I generate a new key, it says token invalid. I couldn’t even get it working once
Also, when I do ems:ValidateKey(“my key”), it always returns {‘error’:‘One or more of the fields are invalid.’}

1 Like

Hm, not sure why you’re getting that error, ill dm you a key, try that one.