Skip to Content
StagePayDocs v2

Operational Alerts (NAVER WORKS)

How to receive payment problems and server errors in a NAVER WORKS bot message room. Covers Developer Console setup, environment variables, the conditions that trigger alerts, severity and grouping rules, and how to test.

When StagePay detects a situation where a payment may have gone wrong (amount mismatch, suspected forged webhook, final merchant callback failure, refund failure, settlement verification mismatch, server 5xx, and so on), it sends an alert to the operations message room through a NAVER WORKS Bot.

  • Alerts are first recorded in alert_events (outbox), and pay's alert-worker sends them to NAVER WORKS. Payment processing does not stop even if recording an alert fails.
  • The same problem is grouped into a single alert for a set period (10 minutes by default). When the window ends, one summary message ("최근 10분간 같은 문제 N건 추가" — "N more of the same problem in the last 10 minutes") is sent.
  • Alerts contain identifiers only, such as transaction number, app, PG, and amount. Card details, tokens, and secrets are never included, and email addresses keep only their first character.
  • Under Payments → Payment alerts in the console, you can view the connection status, last delivery, failure count, and alert log, and send a test alert.

1. Developer Console setup

Perform these steps with an administrator account in the NAVER WORKS Developer Console.

Create an app

Create an app under API 2.0 → Add app and note its Client ID and Client Secret. Add bot (or bot.message) to the OAuth Scopes.

Service account and private key

On the same app screen, issue a Service Account (in the form xxxx.serviceaccount@domain). Download the Private Key. The private key can be downloaded only once, so keep it in a secure secret store.

Register a bot

Create a bot under Bot → Register and note its Bot ID (numeric). In the admin screen, add the bot to your company (domain).

Invite the bot to the message room

Invite the bot to the message room that will receive alerts. Copy the Channel ID from the message room's drawer menu. Messages are rejected if the bot is not in the room. To send alerts 1:1 to a single person instead of a message room, use a user ID instead of a channel ID.

2. Environment variables

Set these on the pay container (alert worker). Always inject NAVERWORKS_CLIENT_SECRET and NAVERWORKS_PRIVATE_KEY as Secrets, and never commit them to the repository.

VariableDescriptionDefault
ALERT_ENABLEDAlerts are sent only when truefalse
NAVERWORKS_CLIENT_IDApp Client ID
NAVERWORKS_CLIENT_SECRETApp Client Secret (secret)
NAVERWORKS_SERVICE_ACCOUNTService account ID
NAVERWORKS_PRIVATE_KEYPrivate key as raw PEM or base64(PEM) (secret). To provide it as a file, use NAVERWORKS_PRIVATE_KEY_FILE
NAVERWORKS_BOT_IDBot ID
NAVERWORKS_CHANNEL_IDMessage room channel ID (if absent, sends 1:1 to NAVERWORKS_USER_ID)
NAVERWORKS_AUTH_URLToken issuance URLhttps://auth.worksmobile.com/oauth2/v2.0/token
NAVERWORKS_API_URLAPI base URLhttps://www.worksapis.com/v1.0
ALERT_MIN_SEVERITYSend only alerts at or above this severity (info / warning / critical)warning
ALERT_THROTTLE_SECONDSGrouping window for the same problem (seconds). Set the same value on api as well600
ALERT_CONSOLE_URLConsole address for the "콘솔에서 보기" (View in console) button (e.g. https://console.stagepay.io). If absent, a plain text message without a button is sent

If ALERT_ENABLED is off or a required value is missing, alerts are recorded as Skipped and the worker logs this only once. The service keeps running normally.

Authentication uses the NAVER WORKS service account method. The worker signs a JWT (RS256, iss = Client ID, sub = service account, valid for 1 hour) with the private key to obtain an Access Token, and reuses it until 5 minutes before it expires. The token is stored encrypted with APP_KEY.

3. When alerts are sent

CategorySituationSeverity
PaymentThe amount or currency confirmed by the PG differs from the stored transaction (webhook verification or confirmation step)Critical
PaymentPG verification completed, but there is no transaction to confirmWarning
WebhookSignature/hash mismatch, identifier mismatch, or a webhook arriving via a different PG's path (suspected forgery)Warning
PGPG query or approval API failure, verification credentials not configuredWarning
Merchant callbackEvery attempt in the retry schedule (1 minute … 24 hours, 9 in total) failed, or there is no callback URLCritical
RefundThe PG rejected the refund, or the PG call failedWarning
RefundThe PG refunded, but updating the transaction failed (REFUND_RECORD_FAILED), or an exception occurred during refund processingCritical
SettlementThree-way verification mismatch, VERIFIED → DRAFT on re-verification, automatic generation (scheduler) failureCritical
USDTDeposit after expiry, underpayment, or overpayment (needs review), deposit cancelled by a chain reorganization, a spike in RPC communication errors, missing chain query configuration, stalled manual processing requestsWarning
SystemUnhandled exceptions/5xx in pay and api (grouped by path + exception type, including REST POST /api/v1/payments), and other error logsCritical/Warning

USDT items and other error logs are found by the alert worker's detectors, which scan logs and DB state every 30 seconds. The same state is alerted only once.

4. Message format

[치명] 가맹점 콜백 최종 실패
가맹점 서버로 콜백(payment.succeeded)을 9회 보냈지만 모두 실패해 재시도를 멈췄습니다 (마지막 응답 HTTP 500). …

· 거래: STAGEPAY-20261128082112-5fe83e-0e03fff4
· 앱: 데모 게임 (6b0a53f0c8612d11b0002af2)
· PG: STRIPE
· 금액: 9.99 USD
· HTTP 상태: 500
· 전송 ID: c622b821-af88-4236-ae13-62cae3d64be1
· 발생: 2026-11-28 17:21:13 KST
· 요청 ID: 1572c85b2fb5520a64bab463f70a8219
  • Bot messages are written in Korean. The example above is a final merchant callback failure alert listing the transaction, app, PG, amount, HTTP status, delivery ID, time of occurrence, and request ID.
  • The prefix depends on severity: [치명] / [경고] / [정보] (critical / warning / info).
  • If ALERT_CONSOLE_URL is set, a "콘솔에서 보기" (View in console) button is attached (the body of a button message is truncated to 1,000 characters, and a text message to 2,000 characters).
  • Amounts are shown with the number of decimal places of the transaction currency.

5. Severity and grouping

  • Alerts below ALERT_MIN_SEVERITY (default warning) are not sent and are recorded as skipped. Test alerts are the exception.
  • For the same grouping key (e.g. webhook.pg_mismatch:STRIPE, callback.exhausted:<appId>), only the first alert is sent during ALERT_THROTTLE_SECONDS, and the rest are only counted. When the window ends, one summary is sent.
  • To stay within NAVER WORKS rate limits (60 calls per minute and 5 concurrent, free plan), at most 50 alerts per minute are sent. On a 429 response, the worker waits for rateLimit-reset seconds and then resends. On 5xx or network errors, it retries up to 8 times with a delay starting at 15 seconds and doubling each time (up to 30 minutes), then records the alert as failed.
  • The alert log is retained for 90 days.

6. Testing

In the console, go to Payments → Payment alerts and click Send test alert. A [정보] 테스트 알림 ([Info] Test alert) message should arrive in the message room. After a few seconds, check that its status in the list is Sent.

Status on screenWhat to check
OffALERT_ENABLED=true
Setup requiredThe missing environment variables shown on the card
Worker not respondingThe alert-worker process in the pay container (supervisorctl status)
Delivery failed token_http_401That the Client ID/Secret, service account, and private key belong together
Delivery failed message_http_403Whether the bot has been invited to the message room, and the channel ID

You can also check via GraphQL (operators only): alertStatus, alertEvents(filter, page, limit), sendTestAlert.

On this page