Platform
Chatbot Builder Bulk Messaging Team Inbox Mini CRM API & Webhooks AI Integration WhatsApp Flows
Industries
E-commerce & D2C Real Estate Education Healthcare Finance & BFSI Logistics Hospitality Retail
Integrations
Learn
Learning Hub Help & Docs Connect Guides Automation Codex Blog Message Templates
Pricing Get Started →
HomeConnect › Connect SAP Business One to WhatsApp
SAP Business One Integration Guide · ERP / Enterprise

Connect SAP Business One to WhatsApp

Query Business Partner records from your SAP B1 installation in a WhatsApp chatbot. When a customer messages you, look up their account by phone number using the SAP B1 Service Layer and reply with their account name, balance, or order history.

Published 22 June 2026  ·  9 min read  ·  ERP / Enterprise

Before following this guide, read the External API Request step foundation guide. It covers every field in the step interface so this guide can focus on SAP B1-specific values.

Network accessibility required before anything else

SAP Business One is almost always installed on-premise or in a private cloud. For WA.Expert to call the Service Layer, your SAP B1 server must be reachable from the internet. Confirm this with your IT team before attempting any integration steps. The default Service Layer port is 50000.

What you need before starting

RequirementWhere to find itNotes
SAP B1 server URLYour IT teamThe server must be accessible from the internet. e.g. https://erp.yourcompany.com:50000
Company database nameSAP B1 Administration > Company Details > Database NameThe exact database name as configured in SAP B1 (case-sensitive)
SAP B1 username and passwordYour SAP B1 adminUse a dedicated service account with read-only access to Business Partners
Network access confirmedIT/network teamPort 50000 must be open to WA.Expert's servers, or a reverse proxy must forward HTTPS requests to it
Use a dedicated read-only service account

Create a dedicated SAP B1 user for the WhatsApp integration with read-only access to Business Partners. Do not use an admin account. If the credentials are ever exposed, a limited account reduces risk. Set the account's permissions to read Business Partners only.

Step 1: Login to get a B1SESSION cookie

SAP B1 Service Layer uses session-based authentication, unlike every other CRM in this series which uses Bearer tokens or API keys. You POST credentials to a Login endpoint and receive a B1SESSION cookie that authenticates all subsequent requests.

In your WA.Expert chatbot flow, add a first External API Request step to log in:

External API Request Step 1 — Login
Select Method
POST
Request URL
https://erp.yourcompany.com:50000/b1s/v2/Login
Select Auth Type
No Auth
Header Parameters
Content-Typeapplication/json
Select Body Type
JSON
Body
{"CompanyDB": "YOUR_DB_NAME", "UserName": "service_user", "Password": "your_password"}
Choose Response Type
JSON
SAP B1 Service Layer — Login response
{
  "SessionId": "PTRzIjYK-weN6-1Lx1-ZG0J-3ARxfjcU0Shy",
  "Version": "10.0.2310.0",
  "SessionTimeout": 30
}

The B1SESSION cookie is set in the response headers:
Set-Cookie: B1SESSION=PTRzIjYK-weN6-1Lx1-ZG0J-3ARxfjcU0Shy; Path=/b1s

Map the SessionId value as {{b1_session}} for use in Step 2.
Sessions time out after 30 minutes of inactivity by default.
SAP B1 uses cookies, not Bearer tokens

Unlike every other ERP and CRM in this series, SAP B1 authenticates via a session cookie. The B1SESSION cookie value must be sent with every subsequent request in a Cookie header: Cookie: B1SESSION=YOUR_SESSION_ID. This two-step pattern (login then query) is unique to SAP B1.

Step 2: Query Business Partners

With the B1SESSION stored as {{b1_session}} and the customer's phone as {{customer_phone}}, add a second External API Request step:

External API Request Step 2 — Query Business Partners
Select Method
GET
Request URL
https://erp.yourcompany.com:50000/b1s/v2/BusinessPartners?$select=CardCode,CardName,Phone1,Cellular,EmailAddress,Balance&$filter=Phone1 eq '{{customer_phone}}' and CardType eq 'cCustomer'&$top=1
Header Parameters
CookieB1SESSION={{b1_session}}
Content-Typeapplication/json
Choose Response Type
JSON

OData filter patterns for Business Partner lookup

What you wantOData $filter value
Customer by primary phonePhone1 eq '9820000001' and CardType eq 'cCustomer'
Customer by mobileCellular eq '9820000001' and CardType eq 'cCustomer'
Phone or mobile(Phone1 eq '9820000001' or Cellular eq '9820000001') and CardType eq 'cCustomer'
Customer by card codeCardCode eq 'C001' and CardType eq 'cCustomer'
Customer by namestartswith(CardName,'Sharma') and CardType eq 'cCustomer'

CardType values: cCustomer (customers), cSupplier (suppliers), cLead (leads). Always include CardType eq 'cCustomer' to avoid returning suppliers in the results.

Step 3: Map the response to WhatsApp variables

A successful SAP B1 Business Partner response looks like this:

SAP B1 Service Layer — GET /BusinessPartners response
{
  "@odata.context": "...",
  "value": [
    {
      "CardCode": "C001",
      "CardName": "Sharma Textiles Pvt Ltd",
      "Phone1": "9820000001",
      "Cellular": "+919820000001",
      "EmailAddress": "priya@sharma.com",
      "Balance": 125000.0
    }
  ]
}

Map:
value[0].CardCode  → account code
value[0].CardName  → company name
value[0].Balance   → outstanding balance
Results are in a value array

SAP B1 OData responses use a value array, same as Microsoft Dynamics 365. Map as value[0].CardName, value[0].Balance. If the value array is empty, no Business Partner was found with that phone number.

Map these response paths to variables in the External API Request step:

Variable nameResponse pathExample value
card_codevalue[0].CardCodeC001
company_namevalue[0].CardNameSharma Textiles Pvt Ltd
phone1value[0].Phone19820000001
emailvalue[0].EmailAddresspriya@sharma.com
balancevalue[0].Balance125000.0

Balance is the current outstanding balance in the company's base currency. A positive value means the customer owes money; negative means a credit. Use it carefully in WhatsApp replies: some customers may find balance mentions intrusive.

Keep the WhatsApp reply in the free service window

If the customer messaged you first within the last 24 hours, your reply is a free service conversation. For proactive outbound messages from SAP B1 data, use an approved Utility or Marketing template.

Worked example: account status bot

Chatbot flow — SAP B1 Business Partner lookup
Customer messages your WhatsApp number.
WA.Expert captures their phone as {{customer_phone}} = "9820000001".

Step 1 — Login:
POST https://erp.yourcompany.com:50000/b1s/v2/Login
Body: {{"CompanyDB":"SBODEMOIN","UserName":"waexpert","Password":"service_pass"}}
Response: {{"SessionId":"PTRzIjYK-weN6-1Lx1-ZG0J-3ARxfjcU0Shy",...}}
Store: b1_session = "PTRzIjYK-weN6-1Lx1-ZG0J-3ARxfjcU0Shy"

Step 2 — Query:
GET https://erp.yourcompany.com:50000/b1s/v2/BusinessPartners
  ?$select=CardCode,CardName,Balance
  &$filter=Phone1 eq '9820000001' and CardType eq 'cCustomer'
  &$top=1
Cookie: B1SESSION={{b1_session}}

Response mapped:
card_code    = "C001"
company_name = "Sharma Textiles Pvt Ltd"
balance      = "125000.0"

Bot replies (if found):
"Hello, Sharma Textiles.
Your account code: C001

For invoice queries or payments, please reply
INVOICE or SUPPORT and our team will assist you."

Troubleshooting

SymptomLikely causeFix
Connection refused / timeoutSAP B1 server not reachable from internetConfirm with IT that port 50000 is open externally or a reverse proxy forwards requests. Test by accessing the URL from a browser outside the office network.
SSL certificate errorSAP B1 uses a self-signed certificate by defaultInstall a valid SSL certificate on the Service Layer, or configure WA.Expert to accept self-signed certs. Most production deployments should use a valid certificate.
401 on LoginWrong CompanyDB, UserName, or PasswordCase-sensitive check: CompanyDB is the exact database name as configured. Try logging in via the SAP B1 client to verify credentials.
401 on Business Partner queryB1SESSION cookie expired (30-minute timeout)Add a fresh login step before each lookup. Sessions expire after 30 minutes of inactivity.
Empty value arrayPhone number format mismatch or no matchCheck if SAP B1 stores numbers with country code, spaces, or dashes. Try Cellular field as well as Phone1.
Permission denied on queryService account lacks Business Partner read permissionIn SAP B1 Administration > Users, ensure the integration user has View permission for Business Partners.

Common questions

What is the SAP B1 Service Layer?
+
The official REST/OData v4 API for SAP Business One, exposing all business objects under /b1s/v2/. It is the recommended integration interface, replacing the older SOAP-based DI API.
What is a Business Partner in SAP B1?
+
SAP B1's universal entity for all external parties: customers (CardType=cCustomer), suppliers (cSupplier), and leads (cLead). Always filter by CardType eq 'cCustomer' to get customers only.
My SAP B1 is on-premise. Can I still connect it to WhatsApp?
+
Yes, but the Service Layer port (default 50000) must be accessible from the internet. Ask your IT team to open the port or set up a reverse proxy. Use HTTPS with a valid certificate for security.
How long does a B1SESSION last?
+
30 minutes of inactivity by default. Add a login step at the start of each conversation to get a fresh session.
What OData filter searches by phone?
+
$filter=Phone1 eq '9820000001' and CardType eq 'cCustomer'. Also try Cellular for mobile numbers.
Does this incur extra WA.Expert charges?
+
Two External API Request steps per lookup (login + query). On the Complete plan both are included. On Starter, action packs apply from Rs. 49 per 1,000 actions.

Connect SAP Business One to WhatsApp today

Free trial, no credit card required. And if you ever get stuck, we are the only platform in India that answers you live on WhatsApp.

Start Free Trial → Book a Demo
1