web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

webhook registration issue

(3) ShareShare
ReportReport
Posted on by 6
I am trying to register a webhook so I can sync our internal database with any customer or dimension changes.  I have the api up and running but I get "Service has not provided a valid validation token" error when I post to the subscription url: https://api.businesscentral.dynamics.com/v2.0/{tenantId}/Production/api/v2.0/subscriptions
 
I get token properly in return when I test the get method directly (something like https://a1b2c3d4.ngrok-free.app/api/webhook/customer?validationToken=test123 with ngrok) but it doesn't look like BC is hitting the get method with correct validation token with post method.  Is there anything that I need to set up in BC?  I would really appreciate if someone can shed some light on this.
 
Thank you.
I have the same question (0)
  • Suggested answer
    Holly Huffman Profile Picture
    6,530 Super User 2025 Season 2 on at
    Good morning, afternoon, or evening depending on your location!
     
    The error "Service has not provided a valid validation token" typically occurs during the webhook registration process in Dynamics 365 Business Central when the validation handshake fails. Here’s how you can troubleshoot and resolve this issue -
     
    Steps to Resolve Webhook Registration Issue
    1. Ensure Proper Handshake Response:
      • When Business Central sends a request to your notificationUrl with the validationToken parameter, your service must respond with:
        • HTTP Status Code 200.
        • The validationToken value returned as raw text in the response body.
      • Example code snippet for handling the handshake:
        app.get('/api/webhook/customer', (req, res) => {
            const validationToken = req.query.validationToken;
            if (validationToken) {
                res.status(200).send(validationToken);
            } else {
                res.status(400).send('Validation token missing');
            }
        });
    2. Verify Notification URL Accessibility:
      • Ensure the notificationUrl is publicly accessible and reachable by Business Central.
      • If you’re using ngrok, confirm that the URL is active and correctly configured.
    3. Check API Subscription Request Format:
      • The POST request to register the webhook must include the correct JSON structure:
        {
            "notificationUrl": "
        https://a1b2c3d4.ngrok-free.app/api/webhook/customer",
            "resource": "/api/v2.0/companies({companyId})/customers",
            "clientState": "optionalValueOf2048"
        }
      • Ensure the resource matches the entity you want to subscribe to (e.g., /customers or /dimensions).
    4. Validate Webhook Configuration in Business Central:
      • Confirm that the API permissions are correctly set up in Business Central.
      • Ensure your user has the necessary roles (e.g., System Administrator or Environment Maker) to register webhooks.
    5. Check for Known Issues:
    6. Test with a Simpler Endpoint:
      • If the issue persists, test the webhook registration with a simpler endpoint (e.g., a basic HTTP server) to isolate the problem.
    Additional Resources
    • You can find more details on webhook registration and troubleshooting here.
     
    Hope this helps some!
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    20,439 Super User 2025 Season 2 on at

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,151

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,443 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,092 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans