Open Heart Protocol
The Open Heart protocol lets an anonymous user sends an emoji reaction to a URL.
How
Set up an endpoint to receive an Open Heart POST
request like this one:
curl -d '🥨' -X POST 'https://api.openheart.fyi'
A Open Heart message should contain of a single emoji sequence. However, the emoji sequence may be followed by arbitrary data which the server is expected to ignore.
This allows HTML <form>
s to post reactions using the Open Heart protocol through an empty input. In this case, the payload will be 🥨=
.
<form action="https://api.openheart.fyi" method="POST" enctype="text/plain">
<button name="🥨">🥨</button>
</form>
Server code
Example
Public API
Alternatively, you can use api.oh
provided by us. See the repository for more details.
UI
It’s a good idea to give visitors an easy way to send such requests; for example, with:
Count
Optionally, a GET
request to the same URL may respond with the emoji reaction counts.
curl 'https://api.openheart.fyi'
The response should be a JSON object mapping Emoji (as Strings) to their count (as Numbers):
{"❤️": 14,"🫀": 12,"🥨": 22}
If reaction counts are write-only, the server should respond with a 403 or a 404.
Questions
Why not WebMention
?
This is much, much, much simpler.
What happens after POST?
The author of the endpoint decides.
What if the someone repeatedly sends emoji to my server?
It shows they may be quite enthusiastic.
What if I don’t want to receive some emoji?
Create a server-side allow list or disallow list and respond with a 400.