DEV Community

Abiodun
Abiodun

Posted on

Building a “Say It Nicer” Laravel API with Telex A2A Integration

Say It Nicer: Making Messages Polite with Laravel & Telex

#hng13 #Laravel #Telex #PHP #APIDevelopment #Gemini

We’ve all sent messages that sounded a bit… harsh. Maybe it was an email, a Slack message, or just a quick text. What if there was a way to automatically soften the tone without losing the meaning? That’s exactly what I set out to do with SayItNicer.

SayItNicer is a Laravel API that takes your message and gives it a kinder, more professional tone. And the cool part? It integrates with Telex A2A agents, so it can easily plug into chat apps or other systems that support Telex.

How It Works

  1. Receiving Messages
    The API is designed to accept messages in JSON-RPC format, which is how Telex agents talk to each other. The messages can have multiple parts, but SayItNicer looks for text.

  2. Checking the Text
    Before doing anything, it checks if there’s actually text to work with. If the request doesn’t contain text, it sends back an error. This ensures the API only processes valid messages.

  3. Polishing the Message
    The heart of the API is a service that rewrites the message. It detects harsh or blunt wording and returns a softer version. For example, “This is too harsh!” might become “Here’s a kinder way to phrase that: …”.

  4. Responding in Telex Format
    Once rewritten, the API sends the message back in JSON-RPC format, so it can be used seamlessly by other agents or applications. Metadata like message IDs and roles are included, keeping everything structured.

  5. Agent Card
    SayItNicer also provides an agent card—basically a profile that describes what it can do. Other Telex agents can use this card to understand its capabilities, input/output types, and examples. It makes discovery and integration effortless.

Why I Built It

  • Improve Communication: Sometimes tone matters more than content.
  • Easy to Integrate: Works with Telex A2A standards out-of-the-box.
  • Extensible: You could add more NLP features, like sentiment detection or emoji handling.
  • Learning Opportunity: It’s a small project but touches on API design, service interfaces, and agent-based systems.

This project was part of my #hng-intern13 journey, and it’s a neat little tool for anyone who wants to make messaging kinder without doing the hard thinking manually.

Imagine a world where your code can gently nudge your messages to be polite. That’s the vision behind Say-It-Nicer.

Top comments (0)