Integration Guide

Integrate WhatsApp API with SAP — Send WhatsApp Messages from SAP

A complete step-by-step guide to integrate the WhatsApp Business API with SAP ECC or S/4HANA. Trigger WhatsApp messages directly from SAP using either SAPConnect (SCOT) for native SAP messaging or ABAP HTTP client for custom programs. Send invoice alerts, order confirmations, delivery updates, and payment reminders to customers automatically from your existing SAP workflows.

Why send WhatsApp from SAP?

SAP runs the core business processes of thousands of enterprises — sales orders, deliveries, invoices, payments, HR notifications, and procurement. Most of this communication still happens over email or SMS, but customers and employees increasingly prefer WhatsApp. With Zaptilo, you can connect SAP to the WhatsApp Business API in two ways — without any middleware, integration platform, or third-party broker.

  • Send order confirmations the moment a sales order is created in VA01
  • Notify customers when an invoice is posted in F-22
  • Send delivery tracking updates from VL01N / VL02N
  • Trigger payment reminders for overdue invoices via background jobs
  • Send goods receipt notifications, PO approvals, and HR alerts
  • Full audit trail in SAP — same as SAPConnect SMS or email

Two Integration Approaches

1. SAPConnect (SCOT)

Configure an HTTP node in SCOT and send WhatsApp using SAP's native messaging infrastructure (same flow as SMS / email). Best for transactional alerts triggered by SAP business documents.

2. ABAP HTTP Client

Call the Zaptilo REST API directly from ABAP using CL_HTTP_CLIENT. More flexible for template parameters, dynamic content, and custom programs.

Prerequisites

  1. SAP ECC 6.0 or SAP S/4HANA system with internet access
  2. A free Zaptilo account with an API token from Developer Tools → Access Tokens
  3. An approved WhatsApp template in your Zaptilo dashboard
  4. SAP basis access for SCOT, SICF, SM59, STRUST configuration
  5. SSL certificate of web.zaptilo.ai imported into SAP STRUST (for HTTPS)

Approach 1: SAPConnect (SCOT) Configuration

Step 1: Open SCOT and Create an HTTP Node

  1. Run transaction SCOT
  2. Navigate to Nodes → Create
  3. Enter node name ZAPTILO and description "Zaptilo WhatsApp Gateway"
  4. Select node type as HTTP and continue

Step 2: Configure the HTTP Endpoint

Set the API server URL:

https://web.zaptilo.ai/api/send/template

Leave username and password blank — Zaptilo uses Bearer token authentication via theAuthorization header.

Step 3: Set Address Type and Activate Node

  1. Add address type PAG (pager / SMS) with address area *
  2. Set retry time period to your preferred value (e.g. 30 minutes)
  3. Tick HTTP node is active and save

Step 4: SICF Handler Configuration

  1. Run transaction SICF
  2. Select default_host → create a new sub-element
  3. Add the following handlers:
    • CL_HTTP_EXT_FORMTORFC
    • CL_HTTP_EXT_XRFC
    • CL_XMS_HTTP_HANDLER
  4. Save and activate the service

Step 5: Define a Pager Service in SA14

  1. Run transaction SA14 in client 000
  2. Create a new entry: Pager Service WHATSAPP, Use WhatsApp Service
  3. In SPRO go to: SAP Web Application Server → Application Server → Basis Services → Address Management → Define Pager Services

Step 6: Test from SBWP

  1. Run transaction SBWP (SAP Business Workplace)
  2. Click New Message and compose a test message
  3. Set recipient type to PAG with the phone number including country code (e.g. 919876543210)
  4. Send and monitor the queue in SCOT

Approach 2: ABAP HTTP Client (CL_HTTP_CLIENT)

For full control over template parameters and dynamic message content, call the Zaptilo API directly from ABAP usingCL_HTTP_CLIENT. This approach is ideal for custom Z-programs, BAdIs, user exits, and background jobs.

Sample ABAP Report

A complete standalone report that sends a WhatsApp template message:

REPORT  zsend_whatsapp.

DATA: lo_http_client TYPE REF TO if_http_client,
      lv_url         TYPE        string,
      lv_token       TYPE        string,
      lv_payload     TYPE        string,
      lv_response    TYPE        string,
      lv_status      TYPE        i.

" Configuration
lv_url   = 'https://web.zaptilo.ai/api/send/template'.
lv_token = 'YOUR_ZAPTILO_API_TOKEN'.

" Build JSON payload for the WhatsApp template
lv_payload =
  '{' &&
  '"number":"919876543210",' &&
  '"template_name":"order_confirmation",' &&
  '"language":"en",' &&
  '"body_values":["John Doe","ORD-12345"]' &&
  '}'.

" Create HTTP client
cl_http_client=>create_by_url(
  EXPORTING url    = lv_url
  IMPORTING client = lo_http_client
  EXCEPTIONS OTHERS = 1 ).

" Set request method and headers
lo_http_client->request->set_method( if_http_request=>co_request_method_post ).
lo_http_client->request->set_header_field( name = 'Content-Type'  value = 'application/json' ).
lo_http_client->request->set_header_field( name = 'Authorization' value = |Bearer { lv_token }| ).

" Set body
lo_http_client->request->set_cdata( lv_payload ).

" Send request
lo_http_client->send( EXCEPTIONS OTHERS = 1 ).
lo_http_client->receive( EXCEPTIONS OTHERS = 1 ).

" Read response
lv_status   = lo_http_client->response->get_header_field( '~status_code' ).
lv_response = lo_http_client->response->get_cdata( ).

" Close connection
lo_http_client->close( ).

" Output result
WRITE: / 'Status:', lv_status.
WRITE: / 'Response:', lv_response.

Replace YOUR_ZAPTILO_API_TOKEN with your actual token.

Reusable Function Module

Wrap the logic into a function module so it can be called from any program, BAdI, or workflow:

FUNCTION z_send_whatsapp_template.
*"----------------------------------------------------------------------
*"  IMPORTING
*"     VALUE(IV_NUMBER)        TYPE  STRING
*"     VALUE(IV_TEMPLATE_NAME) TYPE  STRING
*"     VALUE(IV_BODY_PARAMS)   TYPE  STRINGTAB
*"  EXPORTING
*"     VALUE(EV_STATUS)        TYPE  I
*"     VALUE(EV_RESPONSE)      TYPE  STRING
*"----------------------------------------------------------------------

  DATA: lo_http_client TYPE REF TO if_http_client,
        lv_payload     TYPE string,
        lv_params      TYPE string.

  " Build comma-separated body params as JSON array
  LOOP AT iv_body_params INTO DATA(lv_p).
    IF lv_params IS INITIAL.
      lv_params = |"{ lv_p }"|.
    ELSE.
      lv_params = |{ lv_params },"{ lv_p }"|.
    ENDIF.
  ENDLOOP.

  lv_payload =
    |\{| &&
    |"number":"{ iv_number }",| &&
    |"template_name":"{ iv_template_name }",| &&
    |"language":"en",| &&
    |"body_values":[{ lv_params }]| &&
    |\}|.

  cl_http_client=>create_by_url(
    EXPORTING url = 'https://web.zaptilo.ai/api/send/template'
    IMPORTING client = lo_http_client ).

  lo_http_client->request->set_method( if_http_request=>co_request_method_post ).
  lo_http_client->request->set_header_field( name = 'Content-Type'  value = 'application/json' ).
  lo_http_client->request->set_header_field( name = 'Authorization' value = 'Bearer YOUR_ZAPTILO_API_TOKEN' ).
  lo_http_client->request->set_cdata( lv_payload ).
  lo_http_client->send( ).
  lo_http_client->receive( ).

  ev_status   = lo_http_client->response->get_header_field( '~status_code' ).
  ev_response = lo_http_client->response->get_cdata( ).
  lo_http_client->close( ).
ENDFUNCTION.

SSL Certificate Setup (STRUST)

Since Zaptilo uses HTTPS, you must import the SSL certificate of web.zaptilo.ai into SAP's certificate store via transaction STRUST:

  1. Open STRUST
  2. Select SSL client SSL Client (Anonymous)
  3. Import the Zaptilo SSL certificate (download from your browser)
  4. Save and restart the ICM (SMICM → Administration → Restart)

Common Use Cases

Sales Order Confirmation

Trigger from VA01 user exit when a sales order is saved — send order details to the customer.

Invoice Notification

Send invoice number and amount via WhatsApp the moment FB70 / VF01 posts an invoice.

Delivery Tracking

Notify customers when goods are picked, packed, and dispatched from VL02N.

Payment Reminders

Daily background job sends reminders for invoices overdue by 7, 15, and 30 days.

PO Approval Alerts

Notify approvers via WhatsApp when a purchase order needs their approval.

HR Notifications

Leave approvals, payslip alerts, training reminders straight to employee WhatsApp.

Best Practices

  • Store the Zaptilo API token in a secure custom table or use SSF / encryption — never hard-code in transports.
  • Use background jobs (SM36) for high-volume campaigns to avoid blocking dialog work processes.
  • Wrap calls in TRY...CATCH blocks and log failures to a custom Z-table.
  • Always use approved WhatsApp templates — free-text messages are only allowed within a 24-hour customer service window.
  • Validate phone numbers include country code and have no spaces or formatting characters.
  • Monitor SCOT queues regularly via SOST.

Get your Zaptilo API token

Sign up free, generate your API token, and start sending WhatsApp messages from SAP in minutes. Pay only for what you use — no subscription, no setup fee.

Get Started Free
See also: REST API Documentation · Send WhatsApp from PL/SQL