WhatsApp Messaging – OptoSoft API

Register a WhatsApp Business Account against a branch and manage the message-template library, including syncing approval status back from Meta.

7 endpoints in this module. Every request needs a JWT bearer token — see Authentication.

JWT bearer auth JSON request & response 85 documented endpoints Reviewed monthly

WhatsApp Messaging

OptoSoft sends order updates, eye-test recalls, contact-lens refill reminders and promotional campaigns over the WhatsApp Business Platform. These seven endpoints manage the plumbing: which WhatsApp Business Account a branch sends from, and which approved message templates it can use.

Because WhatsApp business-initiated messages must use a template pre-approved by Meta, the template library is central. OptoSoft keeps a local copy and syncs approval status back from Meta on demand.

These endpoints handle Meta access tokens. A WhatsApp access token grants the ability to send messages as your business. Never log the accessToken field, never expose it to a browser or mobile client, and call these endpoints only from a trusted server.

Configuration only. This module registers accounts and manages templates — it does not expose a "send message" endpoint. Messages are dispatched by OptoSoft automatically as orders and recalls progress.

Account configuration

POST /api/ClientWhatsAppConfig/List Bearer token

Lists the WhatsApp Business Account configurations for a company, with paging. A multi-store chain typically has one configuration per branch.

Request body

FieldTypeRequiredDescription
companyIDint64RequiredCompany (tenant).
branchIDint64OptionalRestrict to one branch.
displayNamestringOptionalFilter by the business display name shown to recipients.
phoneNumberstringOptionalFilter by the sending number.
wabaIDstringOptionalFilter by WhatsApp Business Account ID.
phoneNumberIDstringOptionalFilter by Meta phone number ID.
accessTokenstringOptionalPresent in the model as a filter. Do not send a real token here.
fromPageint32OptionalFirst row of the range.
toPageint32OptionalLast row of the range.
orderBystringOptionalSort column, optionally with DESC.

Response

A paged envelope: totalRows plus a data array of configurations (see the field table under get by ID).

Example request

curl -X POST https://api.opto-soft.com/api/ClientWhatsAppConfig/List \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "companyID": 18,
    "fromPage": 1,
    "toPage": 20,
    "orderBy": "DisplayName"
  }'
GET /api/ClientWhatsAppConfig/{id} Bearer token

Returns one WhatsApp Business Account configuration in full.

Path parameters

NameTypeRequiredDescription
idstringRequiredEncrypted WhatsApp configuration ID.

Response

FieldTypeDescription
whatsAppConfigIDstringEncrypted configuration ID.
companyIDint64Company this configuration belongs to.
branchIDint64Branch that sends from this account.
displayNamestringBusiness name recipients see in WhatsApp.
phoneNumberstringThe sending number in E.164 form.
wabaIDstringMeta WhatsApp Business Account ID.
wabaNamestringAccount name as registered with Meta.
phoneNumberIDstringMeta phone number ID used on send calls.
accessTokenstringMeta access token. Treat as a secret — never log or forward it.
statusstringConnection status reported by Meta.
isActivebooleanWhether OptoSoft will send through this account.
webhookURLstringCallback URL registered with Meta for delivery receipts.
remarksstringInternal notes.
createdByint64Audit — who created it.
createdDatedate-timeAudit — when.
createdIPstringAudit — from where.
modifiedByint64Audit — who last changed it.
modifiedDatedate-timeAudit — when.
modifiedIPstringAudit — from where.

Example request

curl https://api.opto-soft.com/api/ClientWhatsAppConfig/ENCRYPTED_CONFIG_ID \
  -H "Authorization: Bearer YOUR_TOKEN"
POST /api/ClientWhatsAppConfig/Save Bearer token

Creates or updates a WhatsApp Business Account configuration. Supply encryptedWhatsAppConfigID to update an existing one; omit it to create.

Request body

FieldTypeRequiredDescription
encryptedWhatsAppConfigIDstringOptionalEncrypted configuration ID. Omit to create a new one.
wabaIDstringRequiredMeta WhatsApp Business Account ID.
wabaNamestringOptionalAccount name as registered with Meta.
phoneNumberIDstringRequiredMeta phone number ID.
phoneNumberstringRequiredSending number in E.164 form, for example +919876543210.
accessTokenstringRequiredMeta access token. Send over HTTPS from a server only.
displayNamestringRequiredBusiness name shown to recipients.
isActivebooleanOptionalSet false to suspend sending without deleting the configuration.
statusstringOptionalConnection status.
webhookURLstringOptionalDelivery-receipt callback URL registered with Meta.
remarksstringOptionalInternal notes.

Example request

curl -X POST https://api.opto-soft.com/api/ClientWhatsAppConfig/Save \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "wabaID": "102938475610293",
    "wabaName": "OptoSoft Store",
    "phoneNumberID": "109283746501928",
    "phoneNumber": "+919876543210",
    "accessToken": "META_ACCESS_TOKEN",
    "displayName": "Vision Opticals",
    "isActive": true
  }'

Message templates

WhatsApp requires business-initiated messages to use a template approved by Meta. These endpoints read the local template library and refresh its approval status.

GET /api/WhatsAppTemplateMaster/list Bearer token

Lists every message template known to OptoSoft for a company and branch, in any approval state. Use it for an admin screen where you need to see rejected and pending templates too.

Query parameters

NameTypeRequiredDescription
companyIdint64RequiredCompany (tenant).
branchIdint64RequiredBranch.
templateNamestringOptionalFilter by template name.
categorystringOptionalMeta template category, for example UTILITY or MARKETING.
languagestringOptionalLanguage code, for example en or en_US.
isActivebooleanOptionalFilter to active templates only.
fromPageint32OptionalFirst row of the range.
toPageint32OptionalLast row of the range.
orderBystringOptionalSort column, optionally with DESC.

Example request

curl "https://api.opto-soft.com/api/WhatsAppTemplateMaster/list?companyId=18&branchId=24&isActive=true&fromPage=1&toPage=50" \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/WhatsAppTemplateMaster/approved Bearer token

Lists only the templates Meta has approved — the ones you can actually send. This is the endpoint to call when populating a "choose a message" picker, so operators never select a template that will be rejected at send time.

Query parameters

NameTypeRequiredDescription
companyIdint64RequiredCompany (tenant).
branchIdint64RequiredBranch.
templateNamestringOptionalFilter by template name.
categorystringOptionalMeta template category.
languagestringOptionalLanguage code.
fromPageint32OptionalFirst row of the range.
toPageint32OptionalLast row of the range.
orderBystringOptionalSort column.

There is no isActive parameter here — approval status is the filter. That is the only difference from /list.

Example request

curl "https://api.opto-soft.com/api/WhatsAppTemplateMaster/approved?companyId=18&branchId=24&category=UTILITY&language=en" \
  -H "Authorization: Bearer YOUR_TOKEN"
GET /api/WhatsAppTemplateMaster/{id} Bearer token

Returns one template in full, including its body text and the placeholder variables it expects.

Path parameters

NameTypeRequiredDescription
idstringRequiredEncrypted template ID from /list or /approved.

Example request

curl https://api.opto-soft.com/api/WhatsAppTemplateMaster/ENCRYPTED_TEMPLATE_ID \
  -H "Authorization: Bearer YOUR_TOKEN"
POST /api/WhatsAppTemplateMaster/sync Bearer token

Pulls the current template list and approval statuses from Meta into OptoSoft. Run it after submitting a new template for review, or on a schedule, so the local library does not drift from what Meta will actually accept.

Request body

None. Send an empty POST with the Authorization header.

Example request

curl -X POST https://api.opto-soft.com/api/WhatsAppTemplateMaster/sync \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Length: 0"

This call reaches out to Meta, so it is slower than the read endpoints and subject to Meta’s own rate limits. Once or twice a day is plenty — do not call it before every send.

Related

Marketing consent lives on the customer record — the dndForPromotionalMessage and dndForTransactionalMessage flags documented under Customers & Prescriptions. Honour them in any campaign you build. The recall schedule that triggers eye-test reminders is set on the sale — see eyecheckupRecallModel under Quick Sale.

Chat with us Call us