How to re-import Macros in CSV to Zendesk

Answered

8 Comments

  • Anthony Williamson

    +1

    0
  • Nicole S.
    Zendesk Community Team

    Hey Anthony - 

    Does your +1 mean that you have the same question?  

    0
  • Anthony Williamson

    Correct. There is another section that says this is how you export and import with a link that shows how to export into an Excel CSV so you can mass edit and make sweeping changes but 0 indication on how to restore or upload all those changes. Very frustrating and not really useful if I cannot re upload.

    0
  • Nicole S.
    Zendesk Community Team

    Thanks for clarifying. I'm digging into this and will be back with an answer for you later today. 

     

    0
  • Zartashea Mir

    +1

     

    0
  • Mark Lee

    "Thanks for clarifying. I'm digging into this and will be back with an answer for you later today."

    January 11, 2018

    Do you have an answer on this one Nicole? Please update.

    0
  • Nicole S.
    Zendesk Community Team

    Hey Mark - 

    Apologies, I must have gotten derailed. We answer a few hundred posts a day and occasionally things slip between the cracks.

    The answer is that they can be re-imported via the API using a POST to the Create Macro endpoint

     

    0
  • Lucas Martins Lousada

    Was not finding it at all, I created a bashscript to do this:

    100% working, 100% stupid.. but I had no time to do this

    $ cat desk.sh

     

    #!/bin/bash
    user='email'
    passwd='passwd'

    # how many entries to create

    #this could get how many entries json have with something like ( cat file.json | grep title | wc -l )
    howmany=90

    #get macros from zendesk user

    #this will not get page 2 /3 etc.. need to be updated to do this
    #nciphermacros=$(curl https://{GET_FROM_HERE}.zendesk.com/api/v2/macros/active.json -v -u $user:$passwd)

     

    # get only user's personal macros and just useful information
    #mymacros=$(echo $nciphermacros | jq '.macros[] | select(.restriction.type == "User") | {title: .title , active: .active , actions: .actions , restriction: .restriction}')

    # get only non personal user macros
    #mymacros=$(echo $nciphermacros | jq '.macros[] | select(.restriction.type != "User") | {title: .title , active: .active , actions: .actions , restriction: .restriction}')

    for((i=0; i <= $howmany ; ++i)) do

    #this will post 1 macro at a time 

    echo $mymacros | jq -s ".[$i]" | xargs -0 -I DATA curl -X POST -H "Content-Type: application/json" -d '{"macro": DATA }' -u $user:$passwd "https://{POST_TO_HERE}.zendesk.com/api/v2/macros.json"

    done

    1

Post is closed for comments.

Powered by Zendesk