Best answer

How can I send Zendesk ticket attachments to a GitLab issue?

  • 11 October 2022
  • 5 replies
  • 148 views

I have a zap that creates a GitLab issue from a new Zendesk ticket. Everything works fine except the attached files.

I have a field “Zendesk Ticket Attachments” containing the ticket’s attachments from the trigger step, but there’s no receiving field for the attachments in the GitLab action step “create issue”. When I add the field “Zendesk Ticket Attachments” to the GitLab issue description field (as it’s possible when creating an issue directly inside GitLab), I just see a lot of text containing several attributes and an URL of the attachments.

Is there a way to extract the pure attachment URL from the field “Zendesk Ticket Attachments”? If this is possible, maybe I could then post the URLs in the format ![alt text](img/markdown_logo.png "Title Text").

Thanks for your help,
Alex

icon

Best answer by RALaBarge 13 October 2022, 13:58

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

5 replies

Userlevel 7
Badge +8

Hi @AlexC 

 

If you can post the response you get from the ZenDesk trigger we might be able to help you better. 

There should be a field called “content_url”  

 

Usually such files have the value “Exists but not Shown” 

Hi @MohSwellam,

here is the response from the Zendesk trigger. I see the content of the attachments section. Actually I need only the content of the fields content_url and could provide them to the GitLab issue. I just don’t know how to extract them and hand them over to the issue. It could be just one or many attachments, so I would have to check how many entries are inside the attachments field. Or extract all the URLs only. Do you have an idea?

Thanks a lot for your help!

 

attachments:

     url: https://xportde.zendesk.com/api/v2/attachments/XXXXX.json

     id: XXXXX

     file_name: Bildschirmfoto 2022-10-06 um 10.36.22.png

     content_url: https://xportde.zendesk.com/attachments/token/XXXXX/?name=Bildschirmfoto+2022-10-06+um+10.36.22.png

     mapped_content_url: https://xportde.zendesk.com/attachments/token/XXXXX/?name=Bildschirmfoto+2022-10-06+um+10.36.22.png

     content_type: image/png

     size: 584888

     width: null

     height: null

     inline: false

     deleted: false

     malware_access_override: false

     malware_scan_result: malware_not_found

     thumbnails:

          url: https://xportde.zendesk.com/api/v2/attachments/XXXXX.json

          id: XXXXX

          file_name: Bildschirmfoto_2022-10-06_um_10.36.22_thumb.png

          content_url: https://xportde.zendesk.com/attachments/token/XXXXX/?name=Bildschirmfoto_2022-10-06_um_10.36.22_thumb.png

          mapped_content_url: https://xportde.zendesk.com/attachments/token/XXXXX/?name=Bildschirmfoto_2022-10-06_um_10.36.22_thumb.png

          content_type: image/png

          size: 4114

          width: 62

          height: 80

          inline: false

          deleted: false

          malware_access_override: false

          malware_scan_result: malware_not_found

     url: https://xportde.zendesk.com/api/v2/attachments/XXXXX.json

     id: XXXXX

     file_name: hellohotel-factsheet-email.pdf

     content_url: https://xportde.zendesk.com/attachments/token/XXXXX/?name=hellohotel-factsheet-email.pdf

     mapped_content_url: https://xportde.zendesk.com/attachments/token/XXXXX/?name=hellohotel-factsheet-email.pdf

     content_type: application/pdf

     size: 2022809

     width: null

     height: null

     inline: false

     deleted: false

     malware_access_override: false

     malware_scan_result: malware_not_found

     thumbnails:

Userlevel 7
Badge +8

So it seems GitLab Create Issue endpoint doesn't support adding an image. 

 

Referencing GitLAb API, it seems you can only upload “metric” images to Incident Issues using this end point 

 

POST /projects/:id/issues/:issue_iid/metric_images

 

So if that works for you then you can use Webhooks by Zapier to achieve that. 

Userlevel 4
Badge +7

Hey there @AlexC !

 

Taking a look at the GitLab API, they do not support uploading files at all: https://docs.gitlab.com/ee/api/issues.html#new-issue

 

As @MohSwellam mentioned, there is the ability to add “Metrics Images” to issues via a dedicated endpoint, but that is only for “Incident” issues: https://docs.gitlab.com/ee/api/issues.html#upload-metric-image

 

If you needed to upload real files, I would recommend perhaps dropping them in a Dropbox, Box, GDrive, etc. app and then including a link to the file inside of the issue itself!

Userlevel 7
Badge +12

Hi @AlexC!

Did you try giving @RALaBarge’s suggestion a go and if so did it work for you? Also if you were able to find another way to add the files you need to gitlab, we’d love to know the workaround that you used. 

Thanks!