#Upload file enpoint ?
1 messages · Page 1 of 1 (latest)
It's attachments but here's more related info to it https://github.com/twentyhq/twenty/issues/14193
Bug Description referencing the api at https://twenty.apidog.io/create-one-attachment-15882998e0 To upload attachments to a contact there is no Binary or form-data option available :( It only provi...
🚀 thank youu
Hi @fading loom, I've read the github thread but can't seem to find an answer there. The last entry from Felix mentioned that the only way is through GraphQL.
In short I'm trying to build an n8n workflow to pull attachment from emails and push it to Twenty (self-hosted). With GPT, I've set up a http request to domain.com/graphql but got this response.
I'm wondering if you have or have seen a step-by-step guide on how to push an attachment to Twenty?
It's quite tricky but managable
First you need to upload a file with UploadFilesFieldFile mutation from /metadata GraphQL endpoint with request being multipart data type (otherwise you won't be to upload a file), your Bearer token and following data:
- operations:
{"operationName":"UploadFilesFieldFile","variables":{"file":null,"fieldMetadataId":"e870fa90-15e3-4534-8070-4cb05ce8dfde"},"query":"mutation UploadFilesFieldFile($file: Upload!, $fieldMetadataId: String!) {\n uploadFilesFieldFile(file: $file, fieldMetadataId: $fieldMetadataId) {\n id\n path\n size\n createdAt\n url\n __typename}}"} - map:
{"1":["variables.file"]} - 1: (file of your choice)
Then, once file is uploaded properly, you have to make it as an attachment using CreateOneAttachment mutation located at /graphql GraphQL endpoint with GraphQL type and following data:
- operations:
mutation CreateOneAttachment($input: AttachmentCreateInput!) { createAttachment(data: $input) { __typename }} - variables:
{"input": {"name": "cat.jpg","targetPersonId": "20202020-b225-4b3d-a89c-7f6c30df998a","file": [{"fileId": "9f3c0b7d-3985-4c5e-bfed-064e515d65f1","label": "cat.jpg"}], "id": "0d289b1a-6f98-48bf-b772-05d4abc70310"}}
In input:
- name is the original name of your file
- targetPersonId (or target{objectSingularLabel}Id) is a record to which you want to link the uploaded file
- fileId is from previous request where it was uploaded
- label is the same as name
- id is randomly generated UUID