Yapie

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

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

  1. In Yapie, open Settings › Bots and create a bot. Its token is your API key — keep it secret.
  2. Open Settings › Developers & API and subscribe.
  3. 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

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.