Skip to content

McDonald's

Imports McDonald's France restaurants from the McDonald's Location API into Woosmap. Port of the legacy mcdonaldsfrance-storelocator App Engine app; only the GET /api/stores/import/ endpoint survives, with its request and response contract unchanged. Runs on AWS Lambda; EventBridge Scheduler triggers the nightly import.

User-Agent

McDonald's allowlists the connector on its User-Agent: every call to the McDonald's API is sent with User-Agent: fr-woosmap/* (USER_AGENT in services.py). Woosmap calls are not affected.

Endpoint

GET /api/stores/import/

Element Behaviour
Protection The Lambda is reachable only through its Function URL (AWS_IAM auth) or an in-account invoke. EventBridge Scheduler assumes a dedicated role to call it; ad-hoc runs assume OrganizationAccountAccessRole through aws-vault. The handler itself trusts the caller.
date=YYYYMMDD Optional, kept from the legacy contract. Validated (422 when malformed) and otherwise ignored: the API always returns the current referential.
profile=<name> Optional. Runs the import under a named profile of the secret (see Secrets): [a-z0-9-]{1,32}, 422 when malformed or unknown. Absent, the top-level keys of the secret are used.
200 {"status":"ok"} compact JSON with Access-Control-Allow-Origin: *. With Accept: text/xml: <response><status>ok</status></response>.
422 Invalid date, or malformed / unknown profile.
500 Any other failure: McDonald's or Woosmap HTTP error, or a feed with no valid public restaurant. Body {"message": "..."}, with URL query strings redacted so the Woosmap key never leaks.

What it does

  1. Gets a bearer token from POST /v1/security/auth/token with HTTP basic auth (client id and secret), form body grantType=client_credentials and headers mcd-sourceapp: wukong, mcd-marketid: FR.
  2. Calls GET /v2/location/detailsByMarket?market=FR&locale=fr-FR with the bearer token and headers mcd-clientid (the client id), mcd-marketid: FR, mcd-locale: fr-FR, Accept-Language: fr-FR, Accept: application/json and a fresh mcd-correlation-id (UUID, logged, to quote to McDonald's support).
  3. Decodes response.restaurants: a base64 string of gzip-compressed JSON holding the restaurant list.
  4. Validates each record with pydantic. Invalid records (no nationalStoreNumber, name or coordinates, a negative nationalStoreNumber, which Woosmap's storeId rule [A-Za-z0-9]+ would reject for the whole batch, or a day or service time not in HH:MM / HH:MM:SS form) are skipped and counted. Records with availableToPublic: false are filtered out.
  5. Converts the remaining restaurants to Woosmap stores (mapping below).
  6. Sends them to Woosmap in one or more batches. The first batch goes to /stores/replace and swaps out the whole dataset. Any further batches go to /stores and add to it.
    • Batch size. A batch holds at most 5000 stores or 10 MB of request body, whichever is reached first. Woosmap rejects a body over 15 MB with a plain Bad Request (400) page that does not mention size, so the connector stays well below that.
    • One batch or several. When everything fits in one batch, the dataset is swapped in a single step. When it takes several, the dataset is incomplete until the last batch is in.
    • A store that is too big. If a single store cannot fit in a batch, the import stops before anything is sent.
    • Retries. A batch is tried up to 3 times, 5 seconds apart, after a network error or a 5xx. A 4xx means Woosmap refused the data, so it is not retried.
    • Empty feed. If the feed has no valid public restaurant, the import stops before /stores/replace, so an empty or broken response never wipes the dataset.
    • Failure messages. Every failure says how many stores were in the request, how big it was, and what Woosmap holds now: the previous dataset if the first batch failed, or the number of stores already sent if a later batch failed.

Data mapping

Source of truth: new_mappings_simplified.md.

McDonald's field Woosmap field
nationalStoreNumber storeId (whole number as a string, e.g. 25001123)
name name
location.latitude / longitude location.lat / location.lng
address.addressLine1, addressLine2, addressLine3 address.lines (non-empty lines, in order)
address.cityTown address.city
address.postalZip address.zipcode
countryCode address.countryCode
phoneNumbers[] with type == "PRIMARY" contact.phone
storeEmail contact.email
urls[0] contact.website
timeZone openingHours.timezone (last token, e.g. Europe/Paris; falls back to Europe/Paris when unusable)
weekOpeningHours[] openingHours.usual["1"] to ["7"] keyed by weekDay name (Monday is 1)
facilities[].type tags, code as sent (see Tags)
weekOpeningHours[].services[].serviceName tags, code as sent (see Tags)
(none, storeType is empty) types: [] (DEFAULT_TYPES in mapping.py)

userProperties carries nationalStoreNumber, name, gblNumber, id, identifiers, storeIdentifierType, longDescription, isMcOpco, geocAddress, displayAddress, complement, geocCity, displayCity, geocPostCode, displayPostCode, countryCode, x, y, areas, phone, email, contacts, urls, weekOpeningHours (per-service hours, untouched), specialDayServices, storeType and mcDeliveries. Values keep their JSON types. No metaN properties are written.

Opening hours

Day-level startTime and endTime lose their seconds (10:00:00 becomes 10:00). 00:00 to 23:59 or 00:00 becomes [{"all-day": true}]. An overnight window such as 10:00 to 01:00 stays one slot, as the legacy import did. When a day has no startTime / endTime (a handful of restaurants, e.g. Labo 28), the window is taken from that day's services[]: the earliest startTime and the latest endTime across the services with isOpen: true, an end earlier than its start counting as next-day. A day with neither becomes [] and is logged. usual.default is always [].

Tags

Codes are passed through exactly as McDonald's sends them, with no renaming: every facilities[].type on the restaurant (WIFI, DRIVETHRU, PlayPlacePresence, ...) except those whose description is N, plus every weekOpeningHours[].services[].serviceName seen on any day of the week (FRONTCOUNTER, LOBBY, DELIVERY, ...). webStatus is not tagged (it is OPEN on every record). Tags are deduplicated and sorted. The 33 facility codes are listed in McDonald's facilities.tsv and the 9 service codes in services.tsv.

Notifications

Every run ends with a message in the Slack channel whose id is in the slack-channel-id key of the connector secret (#importer-mcdonalds-test, C0CBC6XSBE0, today), posted by a Slack app bot token held under slack-bot-token. The app needs the chat:write and files:write scopes and must be invited to the channel. The report is built from the in-memory result, so no job store is involved, and a Slack failure is logged without failing the import.

Outcome Status line Content
Woosmap push succeeded, no invalid record Completed started and finished time (Europe/Paris), the McDonald's host read (Source) and the Woosmap host written (Target), restaurants fetched, published and skipped, plus an attached JSON snippet (mcdonalds-import-<environment>-<date>.json, e.g. mcdonalds-import-prod-staging-2026-11-04-2214.json) with a published array of ids and a skipped array of {storeId, reason} objects, the reason being availableToPublic is false or the validation error
Woosmap push succeeded, some records invalid Partially Completed same
Any exception, including an empty feed Failed started and finished time, Source and Target, and the reason, with URL query strings redacted; no file

Every report starts with the stack it ran on: local outside Lambda, dev on the woos-connectors-mcdonalds-dev function and prod on woos-connectors-mcdonalds, derived from the AWS_LAMBDA_FUNCTION_NAME variable Lambda sets. A profile run appends its name: prod/staging. With three runs a night in one channel, the label, the Source and Target hosts and the file name are what tell them apart.

A run refused before it starts (unknown profile, a configuration guard from Secrets, or any other failure while resolving the settings) also posts a Failed report, under the lane's own Slack settings, labelled with the requested profile (prod/staging) and without Source / Target since nothing resolved: EventBridge discards the HTTP response, so the channel is where a wrong schedule input shows up.

Leave SLACK_BOT_TOKEN empty locally to log the report and the file content instead of sending them.

Schedule

Three EventBridge Scheduler rules, all Europe/Paris. The client has no access to the Woosmap develop stack, so their staging dataset lives on Woosmap prod under a second private key; the prod function owns it through the staging profile.

Run Function Slot McDonald's feed Woosmap stack and key
dev lane woos-connectors-mcdonalds-dev 22:14 staging develop stack, a Woosmap-internal key
prod, profile=staging woos-connectors-mcdonalds 22:14 staging prod stack, the client's staging key
prod, default woos-connectors-mcdonalds 23:14 (the legacy prod slot) prod prod stack, the client's prod key

The staging runs go an hour ahead so a bad feed surfaces before the prod window. The staging profile schedule is the prod one with rawQueryString = "profile=staging" and queryStringParameters = { profile = "staging" } added to its input (tf-infrastructure/woos-connectors/eu-west-1/mcdonalds/main.tf in the operations repo).

Ad-hoc runs go through Invoking the Lambdas.

Secrets

One JSON blob per lane in AWS Secrets Manager (see Secrets):

  • woos-connectors/mcdonalds (prod, plus the staging profile)
  • woos-connectors/mcdonalds/dev (dev: the McDonald's staging host and a Woosmap-internal key on the develop stack)

Keys:

  • api-base-url (the host McDonald's assigned, e.g. https://na-int03.digital.mcc.mcd.com for staging)
  • client-id
  • client-secret
  • woosmap-private-key
  • woosmap-base-url (https://api.woosmap.com/stores or https://develop-api.woosmap.com/stores)
  • slack-bot-token
  • slack-channel-id
  • profiles (optional): named import profiles, each an object of string values that may set api-base-url, client-id, client-secret, woosmap-private-key, woosmap-base-url and slack-channel-id. woosmap-private-key is required in every profile (see the guards below); any other key left out falls back to the top-level one. slack-bot-token is never per profile.
{
  "api-base-url": "https://<mcdonalds prod host>", "client-id": "...", "client-secret": "...",
  "woosmap-private-key": "<client prod key>",
  "woosmap-base-url": "https://api.woosmap.com/stores",
  "slack-bot-token": "xoxb-...", "slack-channel-id": "C0CBC6XSBE0",
  "profiles": {
    "staging": {
      "api-base-url": "https://eu-stg03.digital.mcc.mcd.com",
      "client-id": "...", "client-secret": "...",
      "woosmap-private-key": "<client staging key, on Woosmap prod>"
    }
  }
}

Guards refuse a configuration before any network call, as a 500 whose message says why, reported to Slack as a Failed run:

  • the dev lane with a woosmap-base-url on api.woosmap.com, whether top-level or from a profile: the dev function only ever writes to the develop stack;
  • a profile without its own woosmap-private-key, or one equal to the top-level key or to another profile's: /stores/replace wipes the project behind the key, so two feeds on one key would overwrite each other. Two different keys on the same Woosmap project are not detectable here, check that with the client;
  • a profile carrying a key not in the list above (a typo would otherwise be silently ignored), or a profiles object that is not a map of names to objects of strings.

Rollout note: because of the first guard, re-seed the dev secret with the develop stack before deploying a build that carries it, or the dev lane fails its next run.

For local development, set the equivalent env vars (uppercase, dashes replaced with underscores) and MCDONALDS_PROFILES (the profiles object as JSON). The app checks env vars first and falls back to the Secrets Manager blob referenced by MCDONALDS_SECRET_ID.

Running locally

The token call needs real McDonald's credentials, so a local run targets the staging API. The tests are the offline path.

cd mcdonalds
export API_BASE_URL="https://na-int03.digital.mcc.mcd.com"
export CLIENT_ID="..."
export CLIENT_SECRET="..."
export WOOSMAP_PRIVATE_KEY="..."
export WOOSMAP_BASE_URL="https://develop-api.woosmap.com/stores"
export SLACK_BOT_TOKEN=""     # empty logs the report; set the xoxb- token to post to Slack
export SLACK_CHANNEL_ID="C0CBC6XSBE0"
export MCDONALDS_PROFILES='{"staging": {"woosmap-private-key": "..."}}'   # optional
uv run uvicorn main:application --reload
curl http://127.0.0.1:8000/api/stores/import/
curl "http://127.0.0.1:8000/api/stores/import/?profile=staging"

Testing

cd mcdonalds
bash test.sh

Runs ruff (lint + format check), mypy (strict), and pytest with branch coverage enforced at 80%. The fixtures in tests/fixtures/restaurants.json are six real records from the McDonald's staging feed of 21 October 2026.