Skip to main content

Subscribe to notifications

Subscribe your callback URL to a specific appli category. Withings POSTs to your URL whenever a matching event occurs.

What you'll need
  • An access_token from the OAuth flow
  • A publicly reachable HTTPS callbackurl on your backend
  • An appli value identifying the notification category to subscribe to

Callback URL requirements

Your callback URL must meet the following requirements:

  • HTTPS only — plain HTTP URLs are not accepted
  • No IP addresses or localhost — must be a proper domain name
  • Ports 80 or 443 only — non-standard ports are not supported in production
  • Max 255 characters
  • Must respond to HTTP HEAD requests — Withings sends a HEAD request to verify your URL is reachable before registering it. Make sure your server handles HEAD and returns a 2xx status code.
Applications in restricted mode

If your URL doesn't meet these requirements (e.g. uses HTTP, localhost, or a non-standard port), your application will be limited to 10 linked users. This is intended for development and testing only.

const axios = require('axios');

const accessToken = 'your_access_token';  // Replace with your actual access token

const subscribe = async () => {
  const data = {
    action: 'subscribe',
    callbackurl: 'https://callbackurl.com/',
    appli: 1,
    comment: 'My comment'
  };

  try {
    const response = await axios.post('https://wbsapi.withings.net/notify', data, {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    });

    console.log('Response:', response.data);
  } catch (error) {
    console.error('Error:', error);
  }
};

// Call the async function
subscribe();