← Notes

How to connect PrestaShop to the bitbybit API

Connect the PrestaShop Webservice to the bitbybit Customers API. Set permissions, map one test contact, update it, and verify the result in both systems.

Start with a job you can verify on both sides. In this example, you create a fictional customer in a PrestaShop 9 test store. Your developer reads the name and email through the PrestaShop Webservice, creates or matches the contact in a bitbybit test workspace, then checks what an agent sees in Customers. No WhatsApp message is sent. Once the connection works, decide which changes should flow automatically.

What do you need to set up?

Choose one test customer, the PrestaShop shop that owns the record and the bitbybit workspace that should receive it. Your developer needs read access to that customer in PrestaShop and the appropriate customer permissions in bitbybit. Keep both credentials in the server-side connector.

  1. Choose the source and destination. Identify the test shop, its installation URL, the destination bitbybit workspace and the specific customer ID to use. Pick the system that owns each field. For this example, PrestaShop owns the customer’s name and email.
  2. Enable the PrestaShop Webservice. In the back office, go to Advanced Parameters → Webservice, enable it, then choose Add new webservice key. Generate a key, give it a descriptive name, grant GET on customers, and select the intended shop in a multistore installation. PrestaShop access settings
  3. Create the bitbybit key. In the intended workspace, go to Settings → Developer → Create API Key. Select customers READ and WRITE for this walkthrough. Put each credential in the connector’s server-side secret store. Give the storefront only the public widget snippet from the PrestaShop chat widget guide. bitbybit authentication
  4. Agree on the handoff. The developer should demonstrate one contact created or matched, one subsequent name change on that same contact, and an unchanged record count after replaying the job. These are the merchant’s acceptance checks.

How do you read one customer from your store?

Use a local API client with a private environment. Set the request method to GET and the URL to https://YOUR-STORE.example/api/customers, including the installation subdirectory if your store has one. In the client’s Basic Auth settings, select your PrestaShop key as the username and leave the password empty. Keep credentials out of shared collections. PrestaShop authentication

In the query-parameter editor, enter these values. Replace the sample ID with your fictional customer’s ID. List filters and field selection · Customer fields

Parameter Example value
filter[id] [72]
display [id,firstname,lastname,email]
output_format JSON

Send the request and save the test response as prestashop-test-customer.json in a private working directory. On a machine with Bash, curl and jq, set PS_CUSTOMER_ID to that same ID and load BBB_KEY from your server-side secret store. Extract the source record for the next step.

source_customer=$(jq -ce --arg id "$PS_CUSTOMER_ID" '
  .customers | select(length == 1) | .[0]
  | select((.id | tostring) == $id and (.email | type == "string" and length > 0))
' prestashop-test-customer.json)

Proceed only when the command succeeds and the returned ID and email match your test customer. The mapping is firstname → firstName, lastname → lastName, and email → email. Keep the PrestaShop ID in the connector. bitbybit assigns its own customer ID. Email is enough for this contact example. A WhatsApp use case also needs an appropriate recipient number and permission. If a phone comes from a PrestaShop address, confirm whose number it is, particularly for gift or third-party delivery. PrestaShop address fields · bitbybit customer creation

How do you match the customer in your workspace?

Set the base URL and generate a JSON payload that contains only the three mapped fields. Search the destination first. The search can also match a name or phone, so inspect the actual email and check all result pages before deciding what to do. Customer search

BBB_CUSTOMERS='https://api.bitbybit.studio/customer/api/open/v1/customers'
contact_json=$(jq -ce '{firstName: .firstname, lastName: .lastname, email}' \
  <<< "$source_customer")
curl --fail --silent --show-error --get "$BBB_CUSTOMERS" \
  -H "x-api-key: $BBB_KEY" \
  --data-urlencode "search=$(jq -r '.email' <<< "$contact_json")"
  • One confirmed match: save its bitbybit ID against the source shop and customer ID. Review any shared or conflicting identity before linking.
  • No match: create the test contact once using the command below. Save the returned data.id in the same mapping.
  • Ambiguous match or uncertain create result: stop and reconcile. For scheduled syncs, serialize jobs for each source customer and put a unique constraint on the mapping so two workers cannot create the same contact independently.
# Run only for a confirmed new test contact.
BBB_CUSTOMER_ID=$(curl --fail --silent --show-error "$BBB_CUSTOMERS" \
  -H "x-api-key: $BBB_KEY" -H 'Content-Type: application/json' \
  --data-binary "$contact_json" | jq -er '.data.id')

For a matched contact, set BBB_CUSTOMER_ID to the verified destination ID. Read the record back and open it in bitbybit Customers. Next, change the fictional customer’s first name in PrestaShop, repeat the PrestaShop request, save the updated response and rerun the source read and payload mapping, then update the saved ID. Read it again and confirm the new name, original email and same ID. Create · Update · Read back

curl --fail --silent --show-error "$BBB_CUSTOMERS/$BBB_CUSTOMER_ID" \
  -H "x-api-key: $BBB_KEY"

# After refreshing contact_json from the edited PrestaShop record:
curl --fail --silent --show-error --request PUT "$BBB_CUSTOMERS/$BBB_CUSTOMER_ID" \
  -H "x-api-key: $BBB_KEY" -H 'Content-Type: application/json' \
  --data-binary "$contact_json"

curl --fail --silent --show-error "$BBB_CUSTOMERS/$BBB_CUSTOMER_ID" \
  -H "x-api-key: $BBB_KEY" | jq '.data | {id, firstName, lastName, email}'

What changes when you want ongoing sync or WhatsApp automation?

Merchant goal What the developer adds What you should verify
Keep customer details current A scheduled reader with pagination, a persisted checkpoint, and an overlap window for recently edited records. Apply changes to the mapped bitbybit ID and advance the checkpoint only after successful processing. Edit the same customer twice, replay a batch, and verify one contact with the latest details.
Send a WhatsApp shipping update Use the status-change module and Messaging API in the PrestaShop shipping guide. The module can read its own store data locally. A separate PrestaShop Webservice key is only needed when an external service reads that data. The intended test buyer receives one approved template and an opted-out record receives none.
Bring over a catalog or orders Define product and combination-to-variant mappings first. bitbybit order creation requires line items with bitbybit variant IDs and a shipping address. Confirm inventory, price and fulfillment behavior separately. Compare a multi-variant product and a multi-line test order on both sides before offering agent-assisted order lookup. bitbybit API overview · Order creation

Explore all PrestaShop integration options.