Home SMS OTP Pricing Blog Log in Get started

How to Add SMS Notifications to an AI-Built App in Eswatini

You prompted your way to a working app in an afternoon. Here's how to give it real SMS notifications: no SDK, no vendor lock-in to any one AI tool.

A lot of real, working software now starts as a prompt. Cursor, Claude Code, ChatGPT, and similar tools can scaffold a working backend, a database, and a UI faster than a person typing it by hand. What they can't do on their own is pick a real SMS provider and know it actually reaches a phone in Eswatini. That part still needs a real API and a real decision.

The good news: adding SMS to an AI-built app doesn't require understanding the app's own architecture in detail. It's one HTTP call, which means it drops into whatever stack the AI already generated: Node, Python, a serverless function, anything that can make a POST request.

The one thing every AI-built app needs to get right

Whatever tool built your app, the pattern for adding a real external service is the same: give the AI the actual API contract, not a vague description, and let it wire the call into the code it already generated. A vague prompt like "add SMS notifications" invites a hallucinated API. A prompt with the real request and response shape doesn't.

Here's a prompt you can hand to Claude Code, Cursor, or any AI coding tool, as-is:

Add a function that sends an SMS via the Lunyazi API. POST https://api.lunyazi.com/sms/send Headers: X-Api-Key: (read from env var LUNYAZI_API_KEY), Content-Type: application/json Body: { "to": "<phone number>", "message": "<text>" } On success it returns { "success": true, "cost": <number>, "segments": <number> }. On failure it returns a non-2xx status with { "error": "<reason>" }. A 402 specifically means insufficient credits, a 400 means the request itself is malformed. Wrap this in a reusable function that throws on failure so callers don't need to check status codes themselves. Call it wherever the app needs to notify a user by SMS.

That's enough real, specific information for any capable AI tool to generate correct code on the first attempt, in whatever language your app already uses.

What the AI will actually generate

For a Node.js backend, something close to this:

export async function sendSms(to, message) { const res = await fetch("https://api.lunyazi.com/sms/send", { method: "POST", headers: { "X-Api-Key": process.env.LUNYAZI_API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ to, message }) }); const data = await res.json(); if (!res.ok) throw new Error(data.error || `SMS failed (${res.status})`); return data; }

Or for a Python backend generated the same way:

import os, requests def send_sms(to, message): resp = requests.post( "https://api.lunyazi.com/sms/send", headers={"X-Api-Key": os.environ["LUNYAZI_API_KEY"], "Content-Type": "application/json"}, json={"to": to, "message": message}, ) data = resp.json() if not resp.ok: raise Exception(data.get("error", f"SMS failed ({resp.status_code})")) return data

Same contract, same behavior, whichever language the rest of the app happens to be in. The API doesn't care what generated the code calling it.

Things to check the AI actually got right

AI-generated integration code is usually correct on the first pass when the prompt includes the real contract, but worth verifying these specifically before shipping:

Test before it touches a real customer

Lunyazi provides fixed test numbers that exercise the full request/response cycle without charging real credits or reaching a real carrier. Point your AI-generated integration at one of those first, confirm the shape of the response matches what the code expects, then switch to real numbers.

DestinationCost per segment
Eswatini & South Africa1 credit
UK & Namibia3 credits

Frequently Asked Questions

Does it matter which AI tool built my app?

No. Lunyazi is a plain REST API. Cursor, Claude Code, ChatGPT, Windsurf, or anything else generating code all produce working integrations from the same prompt, since none of them need a vendor-specific SDK to call it.

Can I just ask the AI to "add SMS" without giving it the API details?

You can, but it will likely hallucinate an API that doesn't exist or guess at a request shape that's wrong. Giving it the real endpoint, headers, and response shape (as in the prompt above) gets correct code on the first attempt instead of a debugging loop.

Is an AI-generated integration production-ready as-is?

Check the three things listed above first: API key handling, real error handling, and no blind retries. The same review any hand-written integration would need before going live.

Do I need a developer to set this up?

No. If your app was built through an AI coding tool, adding this is the same kind of prompt that built the rest of the app. No separate SMS-specific expertise required.

Ready to wire it in?

Free to start, no credit card required. Get an API key and give the prompt above to whatever tool built your app.

Get your API key →