Skip to content

Monoprix

Imports Monoprix store data from Salesforce Commerce Cloud into Woosmap.

What it does

  1. Authenticates with Salesforce using OAuth2 client credentials
  2. Fetches all store data from the Salesforce Commerce API
  3. Converts stores to the Woosmap format (location, address, opening hours, tags)
  4. Pushes stores to Woosmap via the /stores/replace endpoint (batches of 5000)

Data mapping

Salesforce field Woosmap field
id storeId
name name
latitude / longitude location.lat / location.lng
country_code address.countryCode
city address.city
postal_code address.zipcode
address1 address.lines[0]
phone contact.phone
c_mpx_store_link contact.website
c_mpx_store-weekday-hours openingHours.usual
c_mpx_store-exceptional-closure openingHours.special
c_mpx_store-delivery-types tags
c_mpx_store-services tags (appended)
c_mpx_store-chain types
c_mpx_opened-after-eight userProperties.openedAfterEight
c_mpx_opened-on-sunday userProperties.openedOnSunday

Stores missing name, latitude, or longitude are silently skipped.

Opening hours

The c_mpx_store-weekday-hours field is a JSON string containing per-day slots. Three patterns are handled:

  • Morning + afternoon: two separate slots (e.g. 08:30-12:30, 14:00-21:00)
  • Continuous: morning open + afternoon close with no break
  • Single slot: morning only or afternoon only

Seconds are truncated from time values (e.g. 08:30:00 becomes 08:30). Days without any hours get an empty slot list. Timezone is always Europe/Paris.

Schedule

Daily at 02:10 Europe/Paris on woos-connectors-monoprix via EventBridge Scheduler. Ad-hoc runs go through Invoking the Lambdas.

Secrets

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

  • woos-connectors/monoprix (prod)
  • woos-connectors/monoprix/dev (dev)

Keys:

  • salesforce-base-url
  • salesforce-client-id
  • salesforce-client-secret
  • salesforce-env
  • woosmap-private-key

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

Running locally

cd monoprix
export SALESFORCE_BASE_URL="..."
export SALESFORCE_CLIENT_ID="..."
export SALESFORCE_CLIENT_SECRET="..."
export SALESFORCE_ENV=""
export WOOSMAP_PRIVATE_KEY="..."
uv run uvicorn main:application --reload

Testing

cd monoprix
bash test.sh

Runs ruff (lint + format check), mypy (strict), and pytest with 100% branch coverage enforced.