How to re-import Macros in CSV to Zendesk | Community
Skip to main content

How to re-import Macros in CSV to Zendesk

  • October 10, 2017
  • 8 replies
  • 0 views

I've read how to export macros in a CSV file - can someone please explain how to re-import them after exporting? Thanks!

This topic has been closed for replies.

8 replies

Tony35
  • January 10, 2018

+1


Nicole17
  • January 10, 2018

Hey Anthony - 

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


Tony35
  • January 11, 2018

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.


Nicole17
  • January 11, 2018

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

 


  • February 12, 2018

+1

 


  • April 23, 2018

"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.


Nicole17
  • April 24, 2018

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

 


  • January 7, 2019

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