Script to generate CSV for DHL Online Frankierung CSV-Import

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nurfz
    Junior Member
    • Feb 2017
    • 12

    Script to generate CSV for DHL Online Frankierung CSV-Import

    Hi, I just want to share my script with you. Maybe, it also helps if someone wants to implement this feature directly in EspoCRM.

    When you want to send a package with the German shipping company DHL (as Privatkunde), you can now upload a CSV file instead of typing the information in a web form.

    I implemented a link between EspoCRM and DHL's CSV Upload. It generates a CSV file for an EspoCRM Account which you can then upload to DHL. We use it in our company.

    It is a shell script (for Bash) and here is the workflow:

    1. Open the customer (=account/contact) in EspoCRM
    2. Copy the URL into the clipboard
    3. Call the script on the terminal: dhl-generate-csv -p

    The script imports the shipping address from the account and falls back to the billing address.
    It let you choose a DHL product (package size/weight).
    Then it automatically uses a coupon code (if you provided such text files).
    Then it copies the filename of the generated CSV file into the clipboard.

    4. Open the DHL page in the browser: https://www.dhl.de/onlinefrankierung
    5. Upload the CSV file (filename is already in the clipboard)

    Call the script with the option -h to see help text and other options.

    https://gist.github.com/schoettl/6b9...78fa318b7781ef
    Last edited by nurfz; 11-23-2020, 10:20 AM.
  • nurfz
    Junior Member
    • Feb 2017
    • 12

    #2
    Updated script: It now supports
    - choose between sender (command line flag -s)
    - send to Espo Account *or* Contact (depending on the URL in clipboard)
    - external configuration file for API key

    Example:
    Code:
    $ dhl-generate-csv -h
    Usage: dhl-generate-csv [options]
    
    Generiert CSV für den CSV-Import bei DHL Online Frankierung:
    
    https://www.dhl.de/onlinefrankierung
    
    EspoCRM Account URL muss vorher ins Clipboard kopiert werden.
    Wenn verfügbar wird automatisch ein Coupon Code gewählt
    (außer wenn -d ist gegeben).
    
    Options:
    -p
      interactivly select product
    -c COUPON_CODE
      coupon code to use
    -s SENDER
      sender company prefix (a[company] or b[company])
      default: acompany
    -f CSV_FILE
      append data to given CSV file
    -h
      print help message
    Last edited by nurfz; 06-10-2020, 05:47 PM.

    Comment


    • esforim
      esforim commented
      Editing a comment
      Cool. Thank you.
      I don't really use DHL but I guess it should work in other country DHL too wouldn't it.

    • nurfz
      nurfz commented
      Editing a comment
      Not sure if non-German DHL sites have the same CSV import interface for private customers. At least the product codes in the script must be updated.
  • nurfz
    Junior Member
    • Feb 2017
    • 12

    #3
    Updated script: Added support for -r (reverse) flag to switch sender and recipient for returns.

    Don't forget to configure readonly variables in the script (near to the top).

    Comment

    • emillod
      Active Community Member
      • Apr 2017
      • 1405

      #4
      I'm thinking about creating extension for sale which will allow users to manage packages through API in few shipping companies like FedEX, DPD, UPS. You know, generating labels, etc.
      I'm not sure if someone would be interested and which shipping companies i should add.

      Comment


      • item
        item commented
        Editing a comment
        Hello @emillod
        i think in my experiment : only this is not "enough"..
        you will the best .. salesPack then develop :
        warehouse,
        link to amazon and other
        integration with a website shop

        then i think it's rentable..
        it's then a little erp
    • emillod
      Active Community Member
      • Apr 2017
      • 1405

      #5
      Originally posted by emillod
      I'm thinking about creating extension for sale which will allow users to manage packages through API in few shipping companies like FedEX, DPD, UPS. You know, generating labels, etc.
      I'm not sure if someone would be interested and which shipping companies i should add.
      Thank you for your comment. I already thought about that. There was also an idea to create some kind of integration with stripe, paypal etc which would be managed through espo.

      Comment

      Working...