Oracle NetSuite is the ERP backbone for many Indian enterprises and global subsidiaries. WA.Expert connects NetSuite events — sales orders, invoice creation, payment application, fulfilment — to WhatsApp messages via SuiteScript 2.0 RESTlets and workflow actions. Full working code included.
NetSuite provides several integration paths, each suited to different technical skill levels. SuiteScript 2.0 User Event scripts fire on record create/edit and can call external HTTP endpoints directly. Workflow Actions provide a no-code alternative within NetSuite's workflow builder. SuiteTalk REST API allows external systems to trigger WhatsApp by reading NetSuite data.
| Integration approach | Complexity | Best for |
|---|---|---|
| SuiteScript 2.0 User Event Script | ⭐⭐ Medium — SuiteScript knowledge needed | Most direct. Script fires on record save and calls WA.Expert immediately. |
| NetSuite Workflow Action | ⭐ Easy — NetSuite admin, no code | Workflow builder → Send HTTP Request action → WA.Expert. No scripting. |
| SuiteTalk REST API + external polling | ⭐⭐ Medium — external server needed | External script polls NetSuite REST API for new records → triggers WhatsApp. |
| RESTlet endpoint | ⭐⭐ Medium — SuiteScript knowledge | Build a custom RESTlet that other systems call to trigger WhatsApp via NetSuite data. |
In NetSuite: Customization → Scripting → Scripts → New. Script Type: User Event. Upload a new .js file with @NScriptType UserEventScript. This script fires afterSubmit on the record type you choose.
The afterSubmit function receives a context object with context.newRecord. Extract customer phone (use entity record lookup), order number (context.newRecord.getValue("tranid")), and amount (context.newRecord.getValue("total")).
Use require(["N/record"]) to load the customer record by internalId. Access the field custentity_whatsapp_number (custom field) or phone field from the entity record.
Use NetSuite's N/https module for external HTTP calls. Create a https.post() call to WA.Expert API with the phone, template name, and variables. N/https handles SSL automatically.
In Script record: Deployments tab → New Deployment. Set Record Type (Sales Order, Invoice, etc.). Set Execute As: specify a service account user. Status: Released. Save and test by creating a Sales Order.
N/https module governance units: 10 per call. Each script execution has 5,000 governance units (standard) or 10,000 (scheduled). For bulk operations, use a Scheduled Script (Map/Reduce) instead of User Event to avoid governance limit hits.
Customization → Workflow → Workflows → New. Record Type: Sales Order (or Invoice, Customer). Trigger On: After Record Submit. Set condition: Record was just created.
Add Action → Send HTTP Request (available in NetSuite 2021.1+). Method: POST. URL: https://api.wa.expert/v1/send. Headers: Content-Type: application/json, Authorization: Bearer YOUR_KEY.
NetSuite workflow uses {field_id} tokens for dynamic content. Body example: {"to":"{custentity_whatsapp}","template":"so_confirm","variables":{"name":"{altname}","order":"{tranid}"}}
Set Status to Released. Test with a new Sales Order. Check Workflow Execution Log (Customization → Workflow → Workflow Execution Log) to debug any errors.
The Send HTTP Request workflow action requires NetSuite 2021.1 or later. For older NetSuite versions, use a SuiteScript User Event script instead. Both achieve the same result — the workflow approach just requires no scripting knowledge.
SuiteScript 2.0 User Event or no-code Workflow Actions — choose your path. WA.Expert handles the WhatsApp API side.