Can you update a contact with only the email address as a reference?

I’m wanting to automate updating contact details from an external system.

The documentation says I need to reference the contact by its ID; can I not do so using its email as that is unique? A previous implementation I did with HappyFox allowed either.

I would rather not have the extra overhead of searching for a contact.

Hi @Stuart_Anderton,

While I understand the reason behind the request, this is not possible in Freshdesk at the moment since we only use the contact id(integer value) as the unique identifier for an existing contact a Freshdesk Account.

So the workflow to be followed will be to search for the contact with the email address -

  1. Search for User by Email
curl --location --request GET 'https://domain.freshdesk.com/api/v2/contacts?email=user@company.com' \ --header 'Authorization: Basic <Base64(API_KEY:X)>'
  1. Then update the contact using the contact id.

P.S - If you are using a JS Framework, you can consume our JS SDK which has built in functions to do this for you. For more information please view the documentation in the link here.

Sample Code -

var freshdesk = require("@freshworks/freshdesk");
let fd = new freshdesk({ domain: 'domain.freshdesk.com', api_key: 'xxxxxxxxx'});
console.log(fd);
fd.contacts.getAllContacts('email=abc@testtest.com').then(function (result) {
  console.log('Data');
  console.log(result);
}).catch(function (err) {
  console.log('Error');
  console.log(err);
});

Hope this helps.

Let me know if you need any more help.

1 Like