# Integrations API - General Questions, File Upload, Webhook

**URL:** <https://community.fibery.io/t/integrations-api-general-questions-file-upload-webhook/5417>\
**Category:** API & Programming\
**Created:** [November 16, 2023, 11:22pm UTC](https://community.fibery.io/t/integrations-api-general-questions-file-upload-webhook/5417 "2023-11-16T23:22:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rothnic](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rothnic/32/1850_2.png) [@rothnic](https://community.fibery.io/u/rothnic)\
**Post date:** [November 16, 2023, 11:22pm UTC](https://community.fibery.io/t/integrations-api-general-questions-file-upload-webhook/5417/1 "2023-11-16T23:22:02Z")

</div>

I’m currently working on a Fibery integration via the Integrations API with DatoCMS. I am pretty close to dynamically supporting most of the fields and relationships, rather than hard-coding a schema mapping.

Questions:

1. **Protecting Data** :

2. **Webhook/Data Sync** :

3. **File Upload** :

---

<div class="post-metadata">

**Author:** ![rothnic](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rothnic/32/1850_2.png) [@rothnic](https://community.fibery.io/u/rothnic)\
**Post date:** [November 21, 2023, 1:28pm UTC](https://community.fibery.io/t/integrations-api-general-questions-file-upload-webhook/5417/2 "2023-11-21T13:28:22Z")

</div>

Bump on this. Somewhat blocked without some guidance here, especially about the file uploads.

---

<div class="post-metadata">

**Author:** ![misha](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/misha/32/12041_2.png) [@misha](https://community.fibery.io/u/misha)\
**Post date:** [November 21, 2023, 4:15pm UTC](https://community.fibery.io/t/integrations-api-general-questions-file-upload-webhook/5417/3 "2023-11-21T16:15:22Z")

</div>

> i’ve seen cases where the syncing process errors out

Hm. this should not be a case. If you respond with 4xx,5xx then we won’t start sync and won’t delete previous data. But the problem can indeed arise if you respond with 200, it’s a full sync mode and “Do not delete Fibery entities…” is turned off

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/7/70020d5c85cd798f0bd72746e18853a7cf14b82a.png) . If you respond with 500 and data gets deleted then it’s a bug on our side

> the cases where a record could potentially be deleted. Is there any insight into this behavior

As I mentioned above entity should be deleted only when “Do not delete Fibery entities…” is turned off (which is default) and either full sync is happening OR the returned entity has `__syncAction: 'REMOVE'` field.

> When the data from a webhook is sent to the /transform endpoint, is there any way to know which fields have actually been configured on the model to sync?

Well, I believe it can be done on Connector’s side. `/transform` endpoint receives account and filter, so you can easily re-construct schema for it and see what fields it have. Actually we are doing something similar in Intercom/Hubspot connectors. Probably you’ll want to add a cache for schema construction to not hit rate limits of 3rd party system

> **File Upload**

Just to make sure: As I can see it should be `subType: "file"`. Singular form is used. Does it resolve your issue?

---

<div class="post-metadata">

**Author:** ![rothnic](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rothnic/32/1850_2.png) [@rothnic](https://community.fibery.io/u/rothnic)\
**Post date:** [November 21, 2023, 4:30pm UTC](https://community.fibery.io/t/integrations-api-general-questions-file-upload-webhook/5417/4 "2023-11-21T16:30:03Z")

</div>

Thanks for the response about deleting data, I’ll do some more testing.

> [@misha](#):
>
> Well, I believe it can be done on Connector’s side. `/transform` endpoint receives account and filter, so you can easily re-construct schema for it and see what fields it have. Actually we are doing something similar in Intercom/Hubspot connectors. Probably you’ll want to add a cache for schema construction to not hit rate limits of 3rd party system

I am supporting a sync between a flexible type system, much like fibery, and one where there are numerous fields that could be synced, but we might not sync all. So, while I can rebuild the schema in the transform endpoint for the entire model I could sync (which is what I’m doing), I didn’t see where I could know what the schema is that the user actually chose to sync in fibery.

Not the worst case scenario, but just thought it would be nice to have in that transform endpoint.

> [@misha](#):
>
> Just to make sure: As I can see it should be `subType: "file"`. Singular form is used. Does it resolve your issue?

I’ll try, but don’t think that matches [the fibery docs](https://api.fibery.io/apps.html#post-api-v1-synchronizer-schema). Looking again at the notion example, it does use the singular form. Generally the issue I had here was not being sure what was expected to be passed. Is it we have to upload the binary file, or pass in the url, etc.

Then, what happens on the sync. If we return more files (assuming by url) do you replace what exists, or only replace what exists if not matched by url, etc?

---

<div class="post-metadata">

**Author:** ![misha](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/misha/32/12041_2.png) [@misha](https://community.fibery.io/u/misha)\
**Post date:** [November 21, 2023, 4:55pm UTC](https://community.fibery.io/t/integrations-api-general-questions-file-upload-webhook/5417/5 "2023-11-21T16:55:26Z")

</div>

> what the schema is that the user actually chose to sync in fibery

Ah, I see. Yeah, that makes sense. Same can be applied for `synchronizer/data` endpoint as well. But for now passing excessive data shouldn’t make any evil.

> but don’t think that matches [the fibery docs](https://api.fibery.io/apps.html#post-api-v1-synchronizer-schema)

what a shame 🫣 . Will fix it, thanks for spotting it )

> what happens on the sync.

Basically we do a diff between old and new file urls. URLs that are present in both sets are kept untouched, new ones get downloaded, old ones get deleted.

---

<div class="post-metadata">

**Author:** ![rothnic](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rothnic/32/1850_2.png) [@rothnic](https://community.fibery.io/u/rothnic)\
**Post date:** [November 21, 2023, 5:01pm UTC](https://community.fibery.io/t/integrations-api-general-questions-file-upload-webhook/5417/6 "2023-11-21T17:01:30Z")

</div>

> [@misha](#):
>
> Just to make sure: As I can see it should be `subType: "file"`. Singular form is used. Does it resolve your issue?

This did indeed solve my issue. Changing to “file” correctly applied the field type in fibery when setting up the sync. Appreciate the help.

If you do update the docs, it would be helpful to see what the valid mapping is between the type and subtype, if that doesn’t exist somewhere else. Without that notion example I’m not sure i would have been able to figure out what the type should be. Right now they are outlined as two independent fields.

![image](https://sea2.discourse-cdn.com/flex020/images/transparent.png)

---

<div class="post-metadata">

**Author:** ![misha](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/misha/32/12041_2.png) [@misha](https://community.fibery.io/u/misha)\
**Post date:** [November 21, 2023, 5:28pm UTC](https://community.fibery.io/t/integrations-api-general-questions-file-upload-webhook/5417/7 "2023-11-21T17:28:20Z")

</div>

I know, integrations API has its quirks. Unfortunately custom integrations aren’t our top priority right now that’s why docs are underloved (

Can’t give you any estimates when the situation will be changed. Meanwhile feel free to ask any question and I’ll be glad to help you with your integration

---

<div class="post-metadata">

**Author:** ![Evgeni\_Kisel](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/evgeni_kisel/32/13938_2.png) [@Evgeni\_Kisel](https://community.fibery.io/u/Evgeni_Kisel)\
**Post date:** [November 22, 2023, 6:22am UTC](https://community.fibery.io/t/integrations-api-general-questions-file-upload-webhook/5417/8 "2023-11-22T06:22:49Z")

</div>

The doc you are using is a little bit deprecated. Actually we’ve already had up-to-date doc of integration types to fibery types.

[https://the.fibery.io/@public/User\_Guide/Guide/Integration-Schema-Types-213](https://the.fibery.io/@public/User_Guide/Guide/Integration-Schema-Types-213)
