Introduction
If you’re using Freshdesk as your ticket management system you’ve probably notice an annoying quirk with user account activation.
It’s a manual process!
The only way to activate an account after it’s been created is to manually hit the button ‘Send activation email’.
That negatively affects your customer onboarding and wasted your time too.
So we found a way to automated it. 🙂
In this article you’ll learn how to send FreshDesk activation emails automatically using Zapier and some Python code.
Table of Contents
What you will need
1 – Freshdesk
2 – Zapier with Pro plan to be able to run Paths
Setting up the Zapier automation
We manage the process of account creation in Freshdesk automatically when our customers subscribe for our services via ThriveCart.
This automation is handled by Zapier:
1 – Login to your Zapier account
2 – Create an automation selecting any event that you’d like to use as a trigger (in our case it is a ThriveCart purchase event)
3 – Create a new step and select FreshDesk as the application
4 – Choose Action Event – ‘Find Contact’
You might want to ask why do we need this step if we are creating an account from scratch?
But the reason is that you might already have this account in your FreshDesk, so we have 3 following possible cases:
- Account does NOT exist in FreshDesk
- Account DOES exist in Freshdesk but it has not been activated yet
- Account DOES exist in FreshDesk and is active
We want to handle all of these cases and for this we will need the Pro plan from Zapier to be able to use their Paths feature.
5 – Choose your Freshdesk account in Zapier
6 – Fill up the Email field in the next step. You will need to take this information from your Trigger event:
Test this step and if everything is ok then proceed to the next step
7 – Add another action selecting Paths from Zapier
8 – Initially you will have 2 Paths from the beginning, add one more as we need 3 Paths to run this automation.
Case 1: Account does NOT exist in Freshdesk
9 – Edit Path A and select a name for this Path. In our case that would be ‘Doesn’t exist in Freshdesk’
10 – Setup a Rule selecting email from your Trigger event in the first dropdown and condition ‘Does not exist’
11 – Add a step to this Path selecting Freshdesk as an application and choose to ‘Create contact’ option
12 – Fill up the required fields which are ‘Name’ and ‘Email’ with the data from your Trigger event
13 – Add one more step selecting Freshdesk as an application and choose ‘Find Contact’ option
At this point you might be curious why do we need this step again?
Because now when the account has been created we need to get its FreshDesk ID in order for our last step in this Path to work.
14 – Fill up the ‘Email’ field taking it from your Trigger event
15 – Add the last step to this Path selecting ‘Code by Zapier’ with Action event ‘Run Python’
16 – In ‘Customize Run Python’ select the following options:
- Input Data: put a name here for your variable that we will be using in our code
- Select a Freshdesk ID from your previous Zapier step
Here is a code example below that we will be using:
CODE
fdid = input_data ['freshdeskID'] url = 'https://memberfix.freshdesk.com/api/v2/contacts/' + fdid + '/send_invite' headers = {'Authorization': 'Basic am9obi5kb2VAZ21haWwuY29tOnlvdXJwYXNzd29yZDEyMw=='} r = requests.put(url, headers=headers)
17 – Before you proceed with editing the code there is one more step required, you need to encode your Freshdesk login credentials into Base64.
- Go to https://www.base64encode.org/
- Put your login credentials into the first field in the way: youremail@example.com:your_freshdesk_password
- Hit Encode button, you will receive your encoded credentials in the second field (keep the page open, you will need this data in the next step
18 – Copy and paste the code above to ‘Code’ field and modify it according to the instructions below:
- Replace ‘freshdeskID’ with the name that you selected in the previous step (keep the comas!)
- Edit URL part replacing ‘memberfix’ with your Freshdesk URL( example: https://yourdomain.freshdesk.com/api/v2/contacts/)
- Replace ‘am9obi5kb2VAZ21haWwuY29tOnlvdXJwYXNzd29yZDEyMw==’ with your encoded credentials from the previous step.
19 – Hit ‘Done editing’
Case 2: Account exists in FreshDesk but it is Inactive
20 – Go to the next Path, selecting it in the top left corner:
21 – Rename it on your own desire, we’ll be using ‘Does not exist in FreshDesk Inactive’
22 – Repeat Step 10 selecting the email from your Trigger Event
23 – Hit ‘+AND’ button to create second condition and select ‘Active’ field from ‘Find Contact’ step, set (Boolean) is false for this condition:
24 – Add a step ‘Code by Zapier’ and repeat Steps from 14 to 19
Case 3: Account does exist in FreshDesk and active
25 – Go to the last Path and name it according to your needs
26 – Setup the same rules as in Step 23 except that you choose (Boolean) is true for the second condition
27 – Add a step ‘Email by Zapier’ an set Action event to ‘Send Outbound Email’
28 – Customize Outbound Email on your own
29 – Hit ‘Done editing’ and activate your Zap!
Congratulations! You have setup an automation to automatically activate accounts in FreshDesk!
Conclusion
Setting up this automation will allow you to save a lot of time on accounts activation freeing a time for more important things
Now let’s hear from you!
How are you managing your customer’s database?
Tell us your experience in the comments section below!
What do you think of this tutorial?
Article Title: Automatically update records in Airtable after Thrive purchase
Short Description: Tired to manage your customer's database manually? Let's automate this! Click here to read our comprehensive tutorial!
Author: Viktor Nadeyin
Publisher - Orgnization: MemberFix
Publisher Logo: