How to extract user data from an incoming email

Infos:

  • Used Zammad version: 5.3.1 (5.3.1-1675806064.85c9455d.bullseye)
  • Used Zammad installation type: package
  • Operating system: Debian 11.6 (bullseye)
  • Browser + version: Chrome 110, Firefox 110

Expected behavior:

  • The possibility to extract some info from an incoming email, such as specific text patterns with regular expressions, to add some detail data to an existing or new user object.
  • Concretely, when an email arrives, I’d like to add the mobile number (e.g. +49123456789) of the customer in the field mobile in the user object if the email body contains the text #Mobile: +49123456789.

Actual behavior:

  • I can’t find any possibilities in the “Filters” tab at “Settings - Channels - Email” (#channels/email) to manipulate an user object. At this point, only the ticket and article objects are accessible.
  • Also the triggers (#manage/trigger) have no possibility to change an user object.

Steps to reproduce the behavior:

  • Send an email with some specific user data in the mail body to your Zammad system.
  • Try to add that data to the user account that is created or updated.

What I’ve tried so far:

  • I’ve tried to add some postmap filters or triggers to manipulate the user object.
  • I’ve read the admin manual @readthedocs.
  • I search the web for some phrases like “zammad email extract user data”.
  • I’ve search this forum for similar phrases.

Found some similar posts for this problem:

Due to the fact that this posts were closed unresolved, I fear my requirement is unsolvable. Because I think that this would be an useful addition for many integrations, I should rather post a feature request, right?

I’d like to have some sort of intelligent filtering on this as well, but: this is probably hindered due to the various ways people are writing phone numbers as well as email signatures. It’d be easy if everyone strictly adhered to the formatting scheme in your example, but the same phone number might also be represented as variations of:

  • Tel: 0049 123456789
  • 0049 (0) 123 456 789
  • +49 (0)123456789
  • Phone: 0-123-456-789
  • :phone: (+49) 0 123 456 789

And if you take extension numbers or the addition of IVR menu choices into account (e.g. “press ‘2’ for billing”), it gets really weird and any regex used to filter out something that might resemble a telephone number will probably match a lot more than just a phone number.
Also: we have quite a few customers/companies who have emergency/standby or specialized numbers in their signatures, which should only be used in case of emergencies, or for specific purposes. All in all, this is very tricky to automate with filters.

I usually ask agents to be on the lookout for phone numbers in email signatures, and if these come by, have the agents check the customer’s profile if the number is already in their profile, and if it is still current (and if it is not in their profile or if it isn’t current, update the customer’s profile obviously). This is tedious work, but it does guarantee some level of consistency and uniform profile data, as we sanitize the formatting as well.

@dvanzuijlekom Thanks for your reply. Perhaps I misstated my goal a bit: I do not want the core team to add some automated magic to extract data from incoming emails. In fact I want the possibility to do it on my own: e.g. some kind of postmaster filter like [if mailbody regex ‘#phone:(?: )?(.*)’] [then] [modify ticket.customer.phone ‘$1’].

I am not aware of a configurable solution for your problem. But you can use the webhook feature to call a helper daemon (that you’ll need to write yourself) when a ticket is created. And that helper daemon then can update the user information using the REST-API of Zammad.

Maybe something like Huginn (open source alternative to IFTTT/Zapier) also can do the job.

2 Likes

@YetAnotherGerrit Thanks a lot for your hint. Maybe this can do the trick…

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.