RPA bot fails to trigger on SAP invoice creation event, causing AP automation missed

We’ve built an RPA bot in AgilePoint to automate invoice processing from SAP. The bot is supposed to trigger automatically when a new invoice is created in SAP FI module, but it’s not starting consistently. We’re missing about 30% of invoice creation events.

Our setup uses SAP’s event subscription mechanism to send notifications to an AgilePoint webhook endpoint when MM_INVOICE_CREATE event fires. Here’s our webhook configuration:


Webhook URL: https://ourcompany.agilepoint.com/api/rpa/trigger
Event: MM_INVOICE_CREATE
Authentication: Bearer token

When I manually test the webhook endpoint with Postman, the bot triggers correctly. But in production, we’re seeing gaps in the RPA event log where invoices are created in SAP but no corresponding bot execution appears. SAP’s event log shows all events were published successfully. I’ve checked the webhook endpoint logs and don’t see failed requests. It’s like some events are just disappearing between SAP and AgilePoint. Has anyone experienced similar issues with SAP event-driven RPA automation?

Interesting point about the timeout. I’ll check the response time of our webhook. But wouldn’t we see failed delivery attempts in SAP’s event log if that was the issue? The SAP logs show all events as successfully published.

Payload validation errors are usually caused by SAP sending slightly different event structures depending on the invoice type or creation method. Manual invoice creation might send different fields than automated EDI invoice imports. You need to make your webhook more flexible to handle variations in the event payload structure. Use a schema that accepts optional fields rather than requiring strict field matching.

This sounds like a timing or authentication issue. SAP event subscriptions can be tricky because they don’t retry failed deliveries by default. If your webhook endpoint is temporarily unavailable or takes too long to respond, SAP considers it delivered and moves on. Check your webhook timeout settings - it should respond within 5 seconds or SAP will mark it as failed internally even if it eventually processes.

I’ll walk you through a complete solution covering all three critical areas: SAP event subscription, webhook configuration, and RPA event log analysis.

1. SAP Event Subscription Configuration

First, verify your SAP event subscription is configured for guaranteed delivery. In SAP, go to transaction WE20 and check your partner profile for the webhook endpoint:


Partner Type: LS (Logical System)
Message Type: INVOIC
Process Code: MM01 (for MM_INVOICE_CREATE)
Output Mode: 2 (Transfer immediately)
Queue Processing: Enabled

The key is enabling queue processing. This ensures SAP queues events if the endpoint is temporarily unavailable and retries delivery. Without this, events are fire-and-forget.

2. Webhook Endpoint Configuration

In AgilePoint RPA Designer, configure your webhook trigger with these specific settings:


Endpoint Path: /api/rpa/invoice-trigger
Method: POST
Authentication: OAuth 2.0 with refresh token
Timeout: 30 seconds (for acknowledgment)
Payload Validation: Flexible schema mode
Retry Policy: 3 attempts with exponential backoff

Critical change: Switch from static Bearer token to OAuth 2.0 with refresh token. Configure the OAuth settings to automatically refresh tokens every 50 minutes (before the typical 60-minute expiration). This prevents authentication failures.

For the payload validation, use a flexible schema that handles variations:


// Pseudocode - Webhook payload handler:
1. Receive POST request from SAP event subscription
2. Validate required fields only: eventType, invoiceNumber, timestamp
3. Extract all additional fields as optional key-value pairs
4. Log complete payload to RPA event log with correlation ID
5. Immediately return HTTP 200 acknowledgment to SAP (within 5 seconds)
6. Queue bot execution with extracted data as parameters
7. If bot queue is full, store event in fallback database table
// Reference: RPA Designer Guide Section 8.2 - Event-Driven Triggers

The immediate acknowledgment is crucial. Don’t wait for the bot to complete - just queue it and respond to SAP quickly.

3. RPA Event Log Analysis and Monitoring

Implement comprehensive logging to diagnose missing events:

  • Enable verbose logging in AgilePoint Admin Portal under RPA Settings
  • Create a custom monitoring dashboard that compares SAP event counts with AgilePoint bot execution counts
  • Set up an hourly reconciliation job that queries both systems:

SAP Query: SELECT COUNT(*) FROM event_log WHERE event_type='MM_INVOICE_CREATE' AND timestamp > CURRENT_TIMESTAMP - 1 HOUR
AgilePoint Query: SELECT COUNT(*) FROM rpa_execution_log WHERE bot_name='InvoiceProcessor' AND start_time > CURRENT_TIMESTAMP - 1 HOUR

If counts don’t match, trigger an alert with the missing invoice numbers.

4. Handling the 30% Missing Events

For your immediate issue, implement a catch-up mechanism:

  • Create a scheduled RPA bot that runs every 15 minutes
  • Query SAP for invoices created in the last hour that don’t have a corresponding processing record in AgilePoint
  • Manually trigger the invoice processing bot for any missing invoices
  • Log these catch-up executions separately for analysis

This provides a safety net while you fix the root cause.

5. Root Cause - Authentication Token Expiration

Based on your 30% failure rate, I suspect your Bearer token expires after a certain period (likely 60 minutes) and SAP continues sending events with the expired token. The authentication fails silently, and SAP’s event log doesn’t show this as a failure because it considers delivery attempted.

To confirm this theory:

  • Check if the missing events cluster around specific times of day
  • Look for patterns every 60-90 minutes
  • Review your webhook logs for authentication errors that might be getting suppressed

Switching to OAuth 2.0 with automatic token refresh will eliminate this issue completely. We implemented this exact solution for a client processing 500+ SAP invoices daily, and the missing event rate dropped from 28% to less than 0.1% (only during actual system outages).

6. Testing and Validation

After implementing these changes:

  • Perform a load test by creating 100 invoices rapidly in SAP
  • Verify all 100 trigger bot executions
  • Simulate webhook endpoint downtime and confirm SAP queues events for retry
  • Let the OAuth token expire and verify automatic refresh occurs

Document the success rate over a week to confirm the issue is resolved.

I enabled verbose logging and found something interesting. The webhook is receiving all events, but some are being rejected because of payload validation errors. The error message says “Invalid event schema” but doesn’t specify what’s wrong. How do I configure the expected payload schema for the RPA webhook trigger?

SAP’s event log can be misleading - it shows events as published even if the receiving endpoint didn’t acknowledge properly. You need to enable detailed logging on both sides. In AgilePoint, go to RPA Designer and enable verbose logging for webhook triggers. Also, check if your Bearer token is expiring. If SAP is caching the token and it expires mid-day, subsequent webhook calls will fail authentication silently. We had this exact issue and solved it by implementing OAuth refresh token flow instead of static Bearer tokens.