Skip to main content

Developer reference

Integrating with the InPost – Tale Commerce app

The InPost – Tale Commerce app lets customers select an InPost pickup point directly in Shopify checkout. Once an order is placed, the selected pickup point data is stored in the order object - you can read it via Shopify webhooks or the Admin GraphQL API.

This article shows you how to:

  • read the pickup point identifier from an order,
  • detect Weekend Delivery (Paczka w Weekend),
  • normalize shipping method names for reporting.

How it works

The selected pickup point is stored in the order’s shipping line. Reading it comes down to three steps:

  1. Find the shipping line whose carrier identifier equals 817bcd956c0dec08763dd1d56479cc14 - this is the fixed identifier of the InPost – Tale Commerce app.
  2. Read the code field, e.g. INPOST-WAW77N.
  3. Remove the INPOST- prefix - the remaining part (WAW77N) is the pickup point identifier.

Shipping line fields

The order contains an array of shipping lines: shipping_lines in webhooks and shippingLines in GraphQL. The relevant fields:

Webhook GraphQL Description
carrier_identifier carrierIdentifier the app identifier - always 817bcd956c0dec08763dd1d56479cc14
code code the shipping method code containing the pickup point identifier
title title the shipping method name visible to the customer

The title and code fields are named the same in both APIs - only the app identifier notation differs (snake_case and camelCase).

Note: Always use the code field to identify the pickup point. The title field is the customer-facing name - it can change at any time.

Reading order data

Webhook

The payload of order webhooks (e.g. orders/create) contains the shipping_lines array:

{
  "shipping_lines": [
    {
      "carrier_identifier": "817bcd956c0dec08763dd1d56479cc14",
      "code": "INPOST-WAW77N",
      "title": "InPost Paczkomat 24/7 • 1.1 km • WAW77N"
    }
  ]
}

Shopify webhooks documentation: https://shopify.dev/docs/api/webhooks/latest

Admin GraphQL API

query GetOrder($id: ID!) {
  order(id: $id) {
    id
    name
    shippingLines(first: 5) {
      nodes {
        carrierIdentifier
        code
        title
      }
    }
  }
}

Order object documentation: https://shopify.dev/docs/api/admin-graphql/latest/objects/Order

Extracting the pickup point ID

TypeScript example:

const INPOST_APP_CARRIER_ID = "817bcd956c0dec08763dd1d56479cc14"
const INPOST_CODE_PREFIX = "INPOST-"

interface WebhookShippingLine {
  carrier_identifier: string | null
  code: string | null
  title: string
}

function getPickupPointId(shippingLine: WebhookShippingLine): string | null {
  if (shippingLine.carrier_identifier !== INPOST_APP_CARRIER_ID) {
    return null
  }

  const { code } = shippingLine

  if (!code?.startsWith(INPOST_CODE_PREFIX)) {
    return null
  }

  return code.slice(INPOST_CODE_PREFIX.length)
}

Example codes - Poland

code value Point ID Type
INPOST-CSZ17M CSZ17M Locker
INPOST-KRMA01BAPP KRMA01BAPP Locker
INPOST-POP-BIA114 POP-BIA114 Pickup point

Example codes - other countries

For international shipments, the point identifier starts with the country code:

code value Point ID
INPOST-AT981002P AT981002P
INPOST-BE041176 BE041176
INPOST-ES059572 ES059572
INPOST-FR033579 FR033579
INPOST-ITAAQ02468P ITAAQ02468P
INPOST-ITBAT44063M ITBAT44063M
INPOST-LU010779 LU010779
INPOST-NL022165 NL022165
INPOST-PT002296 PT002296
INPOST-UK00008334 UK00008334

Weekend Delivery (Poland only)

The Weekend Delivery option (Paczka w Weekend) is available only for domestic shipments in Poland. It does not change the code field - to detect it, check whether the title field contains the word “weekend”:

function isWeekendDelivery(shippingLine: { title: string }): boolean {
  return shippingLine.title.toLowerCase().includes("weekend")
}

Example title values:

  • InPost Paczkomat 24/7 • 1.1 km • WAW77N - standard delivery
  • InPost Paczkomat 24/7 • 1.1 km • WAW77N • Paczka w Weekend - Weekend Delivery

Normalizing shipping method names

Shipping method names generated by the app include the distance and the pickup point code, for example:

InPost Paczkomat 24/7 • 1.1 km • WAW77N
InPost Paczkopunkt • 0.5 km • POP-WAW722
Locker Mondial Relay • 1.1 km • FR020947
Points Relais® • 0.6 km • FR019857
Abholstation • 0.5 km • AT981002B
Postfiliale • 0.5 km • AT981002P
InPost Locker • 0.5 mi • UK00192101
InPost Shop • 0.4 mi • UK00253499

If your system provides statistics or filtering by shipping method name, it’s worth unifying these names. Simply remove the part containing the distance and point code:

function normalizeShippingName(title: string): string {
  return title.replace(/\d+(?:\.\d+)? (?:km|mi) • [\w-]+/g, "")
}

Normalization results:

Original name After normalization
InPost Paczkomat 24/7 • 1.1 km • WAW77N InPost Paczkomat 24/7
InPost Paczkomat 24/7 • 1.1 km • WAW77N • Paczka w Weekend InPost Paczkomat 24/7 • Paczka w Weekend
InPost Paczkopunkt • 0.5 km • POP-WAW722 InPost Paczkopunkt
Locker Mondial Relay • 1.1 km • FR020947 Locker Mondial Relay
Points Relais® • 0.6 km • FR019857 Points Relais®
InPost Locker • 0.5 mi • UK00192101 InPost Locker

Complete example

The function below processes a shipping line from a webhook or GraphQL and returns all the necessary information:

const INPOST_APP_CARRIER_ID = "817bcd956c0dec08763dd1d56479cc14"
const INPOST_CODE_PREFIX = "INPOST-"

interface WebhookShippingLine {
  carrier_identifier: string | null
  code: string | null
  title: string
}

interface GraphQLShippingLine {
  carrierIdentifier: string | null
  code: string | null
  title: string
}

type ShippingLine = WebhookShippingLine | GraphQLShippingLine

interface ParsedShippingLine {
  pickupPointId: string
  isWeekend: boolean
  originalName: string
  normalizedName: string
}

function normalizeShippingName(title: string): string {
  return title.replace(/\d+(?:\.\d+)? (?:km|mi) • [\w-]+/g, "")
}

function parseShippingLine(shippingLine: ShippingLine): ParsedShippingLine | null {
  const carrierId =
    "carrier_identifier" in shippingLine
      ? shippingLine.carrier_identifier
      : shippingLine.carrierIdentifier

  if (carrierId !== INPOST_APP_CARRIER_ID) {
    return null
  }

  const { code, title } = shippingLine

  if (!code?.startsWith(INPOST_CODE_PREFIX)) {
    return null
  }

  return {
    pickupPointId: code.slice(INPOST_CODE_PREFIX.length),
    isWeekend: title.toLowerCase().includes("weekend"),
    originalName: title,
    normalizedName: normalizeShippingName(title),
  }
}

Webhook usage (Express):

import express from "express"

const app = express()
app.use(express.json())

app.post("/webhooks/orders/create", (req, res) => {
  const order = req.body as { shipping_lines: WebhookShippingLine[] }

  for (const shippingLine of order.shipping_lines) {
    const result = parseShippingLine(shippingLine)

    if (result) {
      console.log(`Pickup point: ${result.pickupPointId}`)
      console.log(`Weekend Delivery: ${result.isWeekend}`)
      console.log(`Shipping method: ${result.normalizedName}`)
    }
  }

  res.sendStatus(200)
})

Note: In production, remember to verify the webhook HMAC signature before processing the payload.

GraphQL response usage:

interface GetOrderResult {
  order: {
    shippingLines: {
      nodes: GraphQLShippingLine[]
    }
  } | null
}

const { order } = await shopifyGraphQL<GetOrderResult>(GET_ORDER_QUERY, { id: orderId })

for (const shippingLine of order?.shippingLines.nodes ?? []) {
  const result = parseShippingLine(shippingLine)

  if (result) {
    console.log(`Pickup point: ${result.pickupPointId}`)
    console.log(`Weekend Delivery: ${result.isWeekend}`)
    console.log(`Shipping method: ${result.normalizedName}`)
  }
}