How to correctly create a custom timelineActivity with multiple relations
Hi Team!!
I'm working on building some really amazing integrations with N8n.io for my TwentyCRM instance that I self host! First off thanks again for a really solid product!
I'm hoping to add in some "custom" events into the Company's Timeline and a custom object of "Automation"'s Timeline for events of "contract viewed", "contract signed", etc.
However I'm struggling to find a good example of how to create a timelineActivity via API. I'm using:
https://twenty.com/developers/rest-api/core#/operations/createOneTimelineActivity
But when I add the two relations, it starts to throw internal server errors that too many attributes (greater than 100) have been used and I cannot view the company or automation record attached to this new timelineActivity until I delete the timelineActitivy via API.
It looks like
properties
JSON object/attribute doesn't have a schema listed, does anyone have more information on what this should look like when putting in a custom message/status?
Hosting type: Docker/K8s
Docker Images:
- twentycrm/twenty:v0.22.1
- twentycrm/twenty-postgres:v0.22.1
Twenty.com
Open Source CRM
3 Replies
Hi @Skyfox675 , timeline activities are supposed to be created based on record updates. We are not used to do that through API, but this is technically possible.
Here is an example of timeline activity creation in the code for example https://github.com/twentyhq/twenty/blob/main/packages/twenty-server/src/modules/calendar/calendar-event-participant-manager/listeners/calendar-event-participant.listener.ts
GitHub
twenty/packages/twenty-server/src/modules/calendar/calendar-event-p...
Building a modern alternative to Salesforce, powered by the community. - twentyhq/twenty
You can also look into this if you can to see how the properties can be used https://github.com/twentyhq/twenty/blob/4157a67bf8807e9642c4614af863b64488f97d24/packages/twenty-server/src/modules/timeline/repositiories/timeline-activity.repository.ts#L9.
We can store the
diff
after an update. This property is set there https://github.com/twentyhq/twenty/blob/4157a67bf8807e9642c4614af863b64488f97d24/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/listeners/entity-events-to-db.listener.ts#L15
But you can put anything you want in this JSON, that's the pointGitHub
twenty/packages/twenty-server/src/engine/api/graphql/workspace-quer...
Building a modern alternative to Salesforce, powered by the community. - twentyhq/twenty
GitHub
twenty/packages/twenty-server/src/modules/timeline/repositiories/ti...
Building a modern alternative to Salesforce, powered by the community. - twentyhq/twenty
Perfect thank you!!