Bitrix24: label from deal
When a deal moves to the required stage, Bitrix24 calls the bridge script: it buys the cheapest label, records the tracking number in the deal field, and leaves a comment in the feed.
Downloadable files
- bitrix24-bridge.php Bitrix24 bridge: outgoing webhook or robot, tracking to the deal
- shippickup.php API client in PHP, single file, no dependencies
What you’ll need
- A server with PHP 7.4+ and HTTPS, Bitrix24 with access to webhooks and custom fields.
- A ShipPickup account and a live API key (
sk_live_…) with the permissions specified in the instructions. The key is created in the dashboard under “API” and stored in your system settings or environment variable.
Step-by-step instructions
- Download
bitrix24-bridge.phpandshippickup.php, upload both to the same folder on your server. - In the ShipPickup dashboard, create a live key (
rates:read,labels:create). Set environment variables from the top of the file:SHIPPICKUP_API_KEY,SHIPPICKUP_FROM,SHIPPICKUP_PARCEL,BRIDGE_SECRET. - In Bitrix24: Developers, Other, create an “Incoming Webhook” with CRM rights. Record its URL in
BITRIX_WEBHOOK_URL. - Create custom fields in the deal: street, city, state, postal code, country (two-letter code), weight (optional), “Tracking”. Record the field codes (
UF_CRM_…) inBITRIX_FIELDSas JSON, example in the file. The deal amount is used as the declared value in dollars. - Specify the stage where the label is purchased in
BITRIX_STAGE(e.g.,PREPARATION). - Set up the bridge call by one of these methods: either an outgoing webhook on deal update, or a “Webhook” robot at the required stage. The URL in both cases is
https://your-server/bitrix24-bridge.php?secret=BRIDGE_SECRET_VALUE.
Important to know
- Update events occur on every deal change, so the bridge checks the stage and skips deals where tracking is already filled.
- Purchase errors appear as comments in the deal feed.
Files contain no keys or passwords: all secrets are set by you in environment settings. Do not publish files with your values.