Waitwhile WaitWhile Integration

WaitWhile: WaitWhile is a queue management and appointment booking platform. This integration allows SMSDESK to receive WaitWhile webhook events and automatically send SMS notifications to customers about their queue position, appointment reminders, and status changes.

Integration type: Inbound webhook receiver (WaitWhile → SMSDESK)

Endpoint: POST https://{host}/api/http/waitwhile/main.ashx?key={api_key}

How It Works

  1. A customer joins a waitlist or books an appointment in WaitWhile
  2. WaitWhile sends a webhook event to the SMSDESK endpoint
  3. SMSDESK verifies the webhook signature using the client's API key as the secret
  4. SMSDESK looks up the client (e.g., clinic name, SMS channel) using the API key
  5. SMSDESK dispatches an SMS to the customer's phone number with relevant details
Multi-Client Support: Each WaitWhile client (e.g., each medical centre or business) gets their own SMSDESK API key. The client's name and SMS channel are dynamically included in every SMS message. No hardcoded client data — just use a different key parameter in the webhook URL for each client.

Prerequisites

Webhook URL

Configure this URL in your WaitWhile webhook settings:

https://{host}/api/http/waitwhile/main.ashx?key={your_api_key}
Replace placeholders:
  • {host} — your SMSDESK deployment domain (e.g., desk.sms.com.na, sms.yourcompany.com)
  • {your_api_key} — the SMSDESK API key for the client/user that will send the SMS

Example URL

https://desk.sms.com.na/api/http/waitwhile/main.ashx?key=FLeJPVIDcmJB8coAb7xcnA7T

Authentication

Authentication is handled via the key query parameter in the webhook URL. This key is the SMSDESK API key stored in client_user.api_key for the specific client/user.

When a webhook event arrives:

  1. SMSDESK extracts the key from the URL
  2. Looks up the client in the database via the get-user backend endpoint
  3. Retrieves clientid, client_name, channel, userid, and user_email
  4. Uses the same API key as the HMAC-SHA256 secret for signature verification
  5. Dispatches SMS using the client's configured channel

Signature Verification

WaitWhile signs each webhook request with an HMAC-SHA256 signature. SMSDESK verifies this signature to ensure the request is genuinely from WaitWhile.

Header

X-Waitwhile-Signature: Base64(HMAC-SHA256(secret, url + payload))

How It Works

Security: The API key serves double duty — it authenticates the client AND verifies the webhook signature. This means each client has a unique secret that only WaitWhile and SMSDESK know.

If the X-Waitwhile-Signature header is present but the signature doesn't match, the request is rejected with 401 Unauthorized. If the header is absent, the request is still processed (for testing purposes), but it's recommended to always enable signatures in WaitWhile.

Supported Events

SMSDESK processes the following WaitWhile webhook event types:

Event Type Trigger SMS Sent? Description
visit.created Customer joins waitlist or booking is created Yes Sends confirmation SMS with ticket number, queue position, and estimated wait time
visit.updated Visit state changes (e.g., WAITING → SERVING) Yes (on state change) Sends SMS when state transitions to SERVING ("it's your turn"), COMPLETE ("visit complete"), or back to WAITING
visit.removed Visit is deleted/cancelled Yes Sends cancellation SMS with instructions to reschedule
message.created WaitWhile sends a message No Logged only — WaitWhile already sent the message directly
location.created/updated/removed Location changes No Logged only — no customer-facing SMS needed

Visit States

WaitWhile visits can be in the following states:

SMS Templates

SMS messages are dynamically generated using the client's name and visit data. The client name is fetched from the SMSDESK database — it is not hardcoded.

visit.created — Waitlist (state: WAITING)

Dear {customerName}, you have been added to the waitlist at {clientName}. Your ticket number is {ticket}. You are at position {position}. Estimated wait time: {waitMinutes} minutes. We will notify you when it's your turn. {clientName}.

visit.created — Booking (state: BOOKED)

Dear {customerName}, your appointment at {clientName} has been confirmed for {formattedDate}. Your booking reference is {ticket}. We look forward to seeing you. {clientName}.

visit.updated — State: SERVING

Dear {customerName}, it's now your turn at {clientName} (Ticket: {ticket}). Please proceed to the reception. {clientName}.

visit.updated — State: COMPLETE

Dear {customerName}, your visit at {clientName} is now complete. Thank you for your patience. For follow-up appointments, please contact us. {clientName}.

visit.removed — Cancellation

Dear {customerName}, your visit at {clientName} (Ticket: {ticket}) has been cancelled. Please contact us to reschedule if needed. {clientName}.
Template variables:
  • {customerName} — from WaitWhile's firstName, lastName, or name fields (falls back to "Valued Customer")
  • {clientName} — from SMSDESK clients.name (looked up via API key)
  • {ticket} — WaitWhile ticket number (e.g., "A001")
  • {position} — Queue position from WaitWhile
  • {waitMinutes} — Estimated wait duration converted from seconds to minutes

Response Format

All responses are JSON with Content-Type: application/json.

Success Response (200)

{
  "status": "ok",
  "eventType": "visit.created",
  "message": "SMS dispatched to 0812345678: OK:26514097:PENDING_ENROUTE"
}

Error Responses

HTTP Status Error Code Description
405 method_not_allowed Only POST requests are accepted
401 missing_api_key No key parameter in the URL
401 invalid_api_key API key not found in the database
401 invalid_signature Webhook signature verification failed
400 empty_payload Request body is empty
500 processing_error Internal error processing the event

Configure in WaitWhile

Step 1: Get Your SMSDESK API Key

  1. Log in to your SMSDESK portal (e.g., https://{host}/portal/)
  2. Navigate to your user settings or SMS channel settings
  3. Copy your API key

Step 2: Set Up the Webhook in WaitWhile

  1. Log in to your WaitWhile account
  2. Go to SettingsIntegrationsWebhooks
  3. Click Add Webhook or New Webhook
  4. Enter the webhook URL:
    https://{host}/api/http/waitwhile/main.ashx?key={your_api_key}
  5. Set the webhook secret to your SMSDESK API key (same value as the key parameter)
  6. Select the events to subscribe to:
    • visit.created — recommended
    • visit.updated — recommended
    • visit.removed — recommended
  7. Save the webhook configuration

Step 3: Test the Webhook

  1. In WaitWhile, use the "Send Test" or "Test Webhook" button if available
  2. Alternatively, add a test visit to your waitlist with a real phone number
  3. Check that an SMS is received on the test phone number
Important: The webhook secret in WaitWhile must be exactly the same as the key value in the webhook URL. Both must be your SMSDESK API key.

Configure in SMSDESK

No special configuration is required in SMSDESK beyond having:

The integration is fully dynamic — the client name, SMS channel, and user info are all looked up from the database at runtime using the API key. Multiple WaitWhile clients can use the same SMSDESK deployment with different API keys.

Testing

Manual Test with cURL

You can emulate a WaitWhile webhook event to test the integration:

curl -X POST \
  "https://{host}/api/http/waitwhile/main.ashx?key={your_api_key}" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "evt_test_001",
    "type": "visit.created",
    "data": {
      "id": "visit_001",
      "state": "WAITING",
      "firstName": "Test",
      "lastName": "User",
      "phone": "0812345678",
      "name": "Test User",
      "ticket": "A001",
      "position": 5,
      "estWaitDuration": 368
    }
  }'

Expected Response

{
  "status": "ok",
  "eventType": "visit.created",
  "message": "SMS dispatched to 0812345678: OK:26514097:PENDING_ENROUTE"
}

Testing with Signature

To test with signature verification, compute the HMAC-SHA256 of url + payload using your API key as the secret:

# Python example
import hmac, hashlib, base64, urllib.request, json

api_key = "your-api-key"
url = "https://{host}/api/http/waitwhile/main.ashx?key=" + api_key
payload = json.dumps({
    "id": "evt_test_001",
    "type": "visit.created",
    "data": {
        "state": "WAITING",
        "firstName": "Test",
        "lastName": "User",
        "phone": "0812345678",
        "ticket": "A001",
        "position": 5,
        "estWaitDuration": 368
    }
})

signature = base64.b64encode(
    hmac.new(api_key.encode(), (url + payload).encode(), hashlib.sha256).digest()
).decode()

req = urllib.request.Request(url, data=payload.encode(), method="POST")
req.add_header("Content-Type", "application/json")
req.add_header("X-Waitwhile-Signature", signature)
response = urllib.request.urlopen(req)
print(response.read().decode())

Troubleshooting

No SMS Received

401 Unauthorized — invalid_signature

401 Unauthorized — invalid_api_key

SMS Sent But Not Delivered

References & Official Documentation

Need Help? Contact your SMSDESK administrator or deployment provider for assistance with configuring the WaitWhile integration.