Yapie for Developers — API, OTP over Yapie, webhooks and a website chat button
Send messages and one-time codes to your customers on Yapie, receive their replies by webhook, and add a "Chat with us" button to your website. Paid developer plans.
What you can build
- OTP over Yapie — send login and verification codes as a Yapie message instead of an SMS. Cheaper, instant, and the person sees exactly which business sent it.
- Notifications — order updates, appointment reminders and alerts to customers who use Yapie.
- Two-way chat — every reply to your bot arrives at your server by webhook; answer through the API.
- A chat button on your website — visitors tap it and continue the conversation with you in Yapie.
Plans
The API, OTP, webhooks and bots are part of the paid developer plan (paid monthly in Yapie credits). Each plan includes a monthly amount of API calls and OTPs; extra OTPs are charged per code. Subscribe in Yapie › Settings › Developers & API, where you can also see your usage.
Quick start
- In Yapie, open Settings › Bots and create a bot. Its token is your API key — keep it secret.
- Open Settings › Developers & API and subscribe.
- Call the API with
Authorization: Bearer <bot token>.
Send a one-time code
curl -X POST https://yapie.app/api/v1/otp \
-H "Authorization: Bearer YOUR_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"to":"+923001234567"}'
The response contains a request_id. When the person types the code into your app or website, check it:
curl -X POST https://yapie.app/api/v1/otp/verify \
-H "Authorization: Bearer YOUR_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"request_id":"…","code":"123456"}'
{"valid": true} means the code is right. Codes expire after 5 minutes (1–30 with ttl_min) and allow 5 attempts.
Send a message
POST /api/v1/messages
{"to": "@username", "text": "Your order #1042 is on its way 🚚"}
to can be an @username, a verified phone number (+92…) or a verified email address. Use chat_id to reply in an existing chat.
Receive replies (webhooks)
Set a webhook URL for your bot in Settings › Developers & API. Every message to your bot is POSTed to it as JSON:
{"event":"message","bot_id":12,"data":{"id":981,"chat":{"id":55,"kind":"direct"},"from":{"id":7,"username":"sara"},"text":"Hi!"}}
Each request carries X-Yapie-Signature: sha256=<hex> — the HMAC-SHA256 of the raw body with your webhook secret. Reject requests whose signature doesn't match. Failed deliveries are retried three times.
Reference
GET /api/v1/me— your bot, plan and usage this monthPOST /api/v1/messages— send a messagePOST /api/v1/otpandPOST /api/v1/otp/verify— one-time codesGET /api/v1/openapi.json— machine-readable description (OpenAPI 3)
The bot API (/bot/<token>/getUpdates, sendMessage) works with the same token for long-polling bots.
Website chat button
Paste this before </body> on any page (use your own @username or your bot's):
<script src="https://yapie.app/widget.js" data-yapie="@yourname" data-label="Chat with us" async></script>
Options: data-color="#7439D6", data-position="left", data-greeting="Hi! How can we help?". The button opens a small panel with your name and picture and a link that starts a chat with you in Yapie (or helps visitors get the free app).
Frequently asked questions
Is the API free?
No — the API, OTP and webhooks need a paid developer plan. Using Yapie as a person is free.Can I message anyone?
You can message people by their @username, verified phone or email. Anyone can block your bot, and sending is rate-limited to protect people from spam.Is OTP over Yapie secure?
Codes are stored only as hashes, expire quickly and allow 5 attempts. The message names your bot so people know who sent it.Try Yapie free
No credit card, no Google account needed. Your chats come with you to every device.