Freshdesk
What it does
Opens a ticket in Freshdesk for each new submission of a form.
What Freshdesk receives:
- the requester's name and email address. The name comes from the customer account when a signed-in customer sends
the form, otherwise from the form's submitter name, or
Guestwhen the form has none. See Submission Identity in Form settings; - the submission title as the subject, with the reference number in front when the form has one (a field with Hide in Submissions only when its Allow in Staff Email Subject is on);
- the whole submission as the ticket's description: every answer except those of fields with Hide in Submissions switched on, including answers of fields you deleted from the form later;
- the agent, group, type, status, priority, source and tags you chose, and the fields you map;
- the files of every File or Gallery field you map, as attachments, whichever ticket attribute you pick for the field. Map them to Attachments to keep the mapping clear.
A field with Hide in Submissions stays in the ticket's subject when its Allow in Staff Email Subject is on, as in the subject of emails to your team. Freshdesk opens the ticket in the visitor's name and, by default, emails them its subject; the subject also shows in the help desk's customer portal. Switch that setting on only for a value the visitor may see.
To keep an answer out of the ticket, switch on Hide in Submissions for its field and leave Allow in Staff Email Subject off. That also hides the answer wherever a submission is displayed: in the admin, the customer account, emails and PDFs. See General field settings.
Install
composer require mageme/module-webforms-addon-freshdesk
bin/magento setup:upgrade
Settings
Connect your Freshdesk account
Go to Stores → Configuration → MageMe Extensions → WebForms, expand Integrations, then Freshdesk.
Enter your Freshdesk Domain, the address you open Freshdesk at, such as yourcompany.freshdesk.com. Enter the
API Key of the Freshdesk agent that opens the tickets. The How to find your API key link under it opens
Freshdesk's help. Click Save Config.
There is no button to test the connection. Send a test submission and look for its ticket in Freshdesk.
These settings can differ per store view, so each store view can open tickets in its own Freshdesk account. To connect one store view only, select it in Scope at the top of the page and clear Use Website next to both settings.
Choose what a form sends
The Freshdesk Integration Settings section appears in a form's settings only for a scope that has a saved connection. If you connected Freshdesk for one store view only, select that store view in Scope at the top of the form's page first.
- Go to Content → WebForms → Manage Forms and click the form's name.
- Under Form Information, click Freshdesk Integration Settings.
- Turn on Create Ticket. In a store view's scope, clear Use Default Value under a setting before you change it.
- In Customer Email, keep Default or pick the form's email field. Default is the address in the form's Submitter Email setting, or the customer account's address.
- Pick the Agent, Group, Type, Status, Priority and Source you want. In Tags, enter one tag per line.
- Under Fields Mapping, click Add for each ticket field you want to fill. Pick it in Freshdesk Ticket Attribute and the form field in Field.
- Click Save.
Type, Status, Priority and Source offer Freshdesk's standard values. Agent, Group and your own ticket fields come from your Freshdesk account: until they are loaded, the section shows "Lists load after Refresh Lists." and Agent offers only -- Unassigned --. On a saved form, click Refresh Lists in the section to load them, or to load them again after you change something in Freshdesk. Refresh Lists works when Scope shows All Store Views; in a store view's scope it is greyed out. So if you want these lists, save the connection in Default Config, where every store view can use it.
Freshdesk Ticket Attribute always lists the standard ticket fields: name, email address and phone number of the requester, subject, type, status, priority, description, attachments, the two due dates, source and tags.
For a Freshdesk ticket field that takes a number, map a Number field of the form. WebForms sends a Number answer as a number and leaves it out when it isn't one. Every other field type, a Phone field included, is sent as text, and Freshdesk refuses text in a number field.
How it works
When a visitor submits the form, WebForms saves the submission and then queues it for Freshdesk. The queue is worked through by Magento's scheduled tasks (cron), so the ticket appears after their next run, not during the visit. A form set to Do Not Store Submissions sends during the visit instead. Editing a submission later doesn't send it again.
A ticket needs an email address or a phone number. Map a phone field to Phone number of the requester if your form asks for a phone number instead of an email address. A submission with neither is skipped.
To send submissions that already exist, or to send one again:
- Go to Content → WebForms → Manage Forms.
- In the form's row, click Select in the Actions column, then click Browse Results.
- Select the checkboxes of the submissions.
- Click Actions, then Create Freshdesk Ticket, and confirm.
WebForms reports how many submissions were sent, skipped and failed. Create Freshdesk Ticket is in the menu only for admins with the Edit Result permission, and only while Create Ticket is on in the form's All Store Views scope and a connection is saved. When Create Ticket is on for a store view only, the menu doesn't offer it.
Every send opens a new ticket: a submission sent twice gives two tickets. This can also happen when Freshdesk created the ticket but its answer didn't reach your store in time, and WebForms tried again.
To check that it worked, look for the ticket in Freshdesk. WebForms doesn't mark a submission as sent.
Troubleshooting
- Nothing reaches Freshdesk. Check that Create Ticket is on for the store view the form was sent from, and
that Freshdesk Domain and API Key are saved for that store view. Ask whoever runs your server to check that
Magento cron is running and to search Magento's system log for "Freshdesk" in any letter case. The lines about
sending start with "WebForms integration" and name the service in lowercase, as
freshdesk. - The form's settings have no Freshdesk section. Save Freshdesk Domain and API Key first. If you saved them for one store view, select that store view in Scope on the form's page.
- The log says "delivery failed" with the code 0. WebForms couldn't reach Freshdesk at all, for example because
Freshdesk Domain is mistyped. The log shows "WebForms integration: delivery failed, will retry" twice for
freshdesk, then "delivery failed, giving up". Nothing in the admin shows it. Correct the domain, save, and send the waiting submissions again from the list. - The API key was refused. The log shows "delivery failed" for
freshdeskwith the code 401: WebForms tries three times and then gives up. Sending from the list reports "Freshdesk did not accept the credentials". Enter the agent's current API Key, save, and send the waiting submissions again from the list. - The ticket has no attachments. Freshdesk created the ticket, but the files didn't reach it. The log says the ticket "was created without its attachments". WebForms doesn't try again, so sending the submission again would open a second ticket. Attach the files to the ticket in Freshdesk yourself.
- Freshdesk refused the ticket, for example because an email address isn't valid. WebForms doesn't try again. Correct the cause and send the submission again from the list.
- Freshdesk didn't answer, or answered with a server error or "too many requests". WebForms tries again, up to three tries in all, waiting longer before each one. After the third failure it gives up and writes an error to the log.
What's next
- Settings: Integrations: the Freshdesk connection.
- Integrations: the other services WebForms can send to.
- General field settings: keep an answer out of the ticket text.