#Email last sent date field

1 messages · Page 1 of 1 (latest)

short shale
#

Is there a way to create a field for the data object 'people' that shows the date of the last sent email to that person? We have linked and synced our email accounts successfully with TwentyCRM 1.14.0. Many thanks.

pastel spire
#

you can create a date field in the People object (call it "last email sent") and then build a workflow that gets triggered every time an email is sent, and updates the field. Would that work?

bold pasture
short shale
short shale
# bold pasture https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/community/last...

I tried it, I got stuck here:

$ yarn auth

... ... ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /opt/twenty/twenty/packages/twenty-apps/community/last-email-interaction/node_modules/uuid/dist-node/index.js from /opt/twenty/twenty/packages/twenty-apps/community/last-email-interaction/node_modules/twenty-sdk/dist/cli.cjs not supported.
Instead change the require of index.js in /opt/twenty/twenty/packages/twenty-apps/community/last-email-interaction/node_modules/twenty-sdk/dist/cli.cjs to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/opt/twenty/twenty/packages/twenty-apps/community/last-email-interaction/node_modules/twenty-sdk/dist/cli.cjs:2:194) {
code: 'ERR_REQUIRE_ESM'
}

I think this is related to the java version. I tried adding:
"resolutions": {
"chalk": "4.1.2"
}
inside: package.json but the error still happened the same.

bold pasture
short shale
#

Thanks, however I did run 'yarn install ' before running the listed commands, I ran it without sudo but it did not work, so I ran it with sudo and it worked (I cloned the repository in to the same folder where twenty has its config files stored, so thats why it needed sudo, I think).
Out put of: yarn install
yarn install
➤ YN0000: · Yarn 4.9.2
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 3s 609ms
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0s 331ms
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: · Done in 4s 214ms

But I still get the same error I listed above.

bold pasture
#

That's really weird 🤔

short shale
#

It's a clean new install of ubuntu server, and a fresh install of twenty 1.14.0

bold pasture
#

Yarn should be run without sudo as all it does is installing packages and it doesn't require higher privileges, also, yarn install at the root of the project installs all packages required only for development skipping entirely packages/twenty-apps folder

#

If you open packages/twenty-apps/community/last-email-interaction/application.config.ts in code editor (VS Code will suffice), does it show any errors?

short shale
# bold pasture If you open `packages/twenty-apps/community/last-email-interaction/application.c...

I don't see any errors (I removed the 3 hash's before posting):

import { type ApplicationConfig } from 'twenty-sdk';

const config: ApplicationConfig = {
universalIdentifier: '718ed9ab-53fc-49c8-8deb-0cff78ecf0d2',
displayName: 'Last email interaction',
description:
'Updates Last interaction and Interaction status fields based on last received email',
icon: "IconMailFast",
applicationVariables: {
TWENTY_API_KEY: {
universalIdentifier: 'aae3f523-4c1f-4805-b3ee-afeb676c381e',
isSecret: true,
description: 'Required to send requests to Twenty',
},
TWENTY_API_URL: {
universalIdentifier: '6d19bb04-45bb-46aa-a4e5-4a2682c7b19d',
isSecret: false,
description: 'Optional, defaults to cloud API URL',
},
},
};

export default config;

#

I expect its something I'm doing wrong!

bold pasture
#

Did you delete those universalIdentifiers?

short shale
#

Yes, as maybe its not good to post them

#

But I did not delete them in the original file

bold pasture
#

They can be posted, they're available publicly in repo either way

dire raptor
#

Hey, it's mandatory to keep the universalIdentifier

#

They ensure entities versioning

bold pasture
#

And just to be sure, in src/index.ts there are also no errors? (you don't have to copy paste file content)

short shale
#

I can't see any errors in that file. I have not modified it. I can see that currently things are missing that would be set if the command worked, like the twenty url.

bold pasture
#

That's because those variables must be set in Twenty once app is synchronized with workspace

#

In Settings > Applications > Last email interaction to be precise

short shale
#

I will try removing and re download the code again. I will put it in on the users home folder instead of in /opt/twenty and see if it will work.

bold pasture
#

Honestly, it beats me why you're getting those errors, never heard of them before, it's definitely a matter of dependencies but why it happens, no idea

short shale
#

Thank you for your help, if it works I will let you know.

dire raptor
#

Hey you can always try clearing your server cache too
yarn command:prod cache:flush in packages/twenty-server

short shale
#

Still broken with the same error at the same place after running in the user home folder. I will have a look again another day. Thanks

bold pasture
bold pasture
short shale
dire raptor
#

You should not be able to install dependencies if you're not on the expected engines versions

normal wyvern
#

It could be an issue with twenty-sdk that ships cli with cjs instead of mjs. I would like to reproduce the issue before, @short shale you pulled the twenty repository, then cd to last-email-interaction, then launched yarn install then yarn auth that's it?

normal wyvern
short shale
short shale
short shale
# bold pasture In Settings > Applications > Last email interaction to be precise

After running yarn auth and yarn sync. I visited Settings > Integrations (in 1.14.0 of twenty the menu link in settings for the Integrations page is missing). I can't find where in the config to switch it back on. But if I go to the URL directly I can access the Integrations page, but I can't see the 'Last email interaction' showing up there at all.
What is the url path for the Settings > Applications > Last email interaction? And do you know what to search for in the config to get this to show up in the setting menu? Many thanks.

short shale
bold pasture
normal wyvern
#

there is a featureFlag IS_APPLICATION_ENABLED

#

are you self-hosting @short shale?

short shale
normal wyvern
#

Yes, this one is not available in the admin pannel, you need to add it manually in core.featureFlag database table

short shale
normal wyvern
#

I can tell you, do you have access to your database?

short shale
normal wyvern
#

ok, then you should connect to your database, and add a new line IS_APPLICATION_ENABLED true for your workspace Id in core.featureFlag table

#

do you know how to get your workspaceId?

short shale
# normal wyvern ok, then you should connect to your database, and add a new line IS_APPLICATION_...

Can I ask some novice questions!

  • Will this brake any functionality when updating TwentyCRM?
  • Should I avoid playing with this on a version we use for work? If yes I can find some time in the future to install a local development version to experiment with.
  • To access the data base, this using is CLI into the data base, correct? If yes, then I also need to look this up as I have not CLI accessed a db for a long time!
  • I don't know how to get my workspaceId!
    Sorry if this is too much trouble!
normal wyvern
#

no pb. I would play on a local version indeed, not your production

#

Will this brake any functionality when updating TwentyCRM?
It should not but extensibility is a work in progress so not very stable yet

#

you can connect using dbeaver for example

#

to get workspaceId, go to twenty, open console, go to network tab, refresh, look at the preview of first metadata request see data->currentWorkspace->id value

short shale
short shale
#

Now that app's are in v1.20.0 of TwentyCRM I tried using last-email-interaction again. I got to yarn sync and then it failed with the following output:

`ubuntu:/opt/twenty/twenty/packages/twenty-apps/community/last-email-interaction$ yarn sync
👩‍💻 Workspace - default
🚀 Syncing Twenty Application
📁 App Path: /opt/twenty/twenty/packages/twenty-apps/community/last-email-interaction

❌ Serverless functions Sync failed: {
message: 'Field "syncApplication" of type "WorkspaceMigration!" must have a selection of subfields. Did you mean "syncApplication { ... }"?',
locations: [ { line: 3, column: 11 } ]`

In the UI the rows are empty as in the image bellow.

bold pasture
#

I'll take care of it today and update it to latest SDK version so that it'll be working

#

The reason for that is very simple, basically there were many updates since I implemented this plugin and I didn't update it as SDK is still not fully released so breaking changes are to be expected

normal wyvern
#

Yes indeed. Things are going to be more stable soon

bold pasture
normal wyvern
#

0.8.0-canary.8

short shale
bold pasture
normal wyvern
#

0.8.0 released guys