IntroductionSetting Up the FormConfiguring the WebhookNameRequest URLRequest MethodRequest FormatRequest HeadersRequest BodyField ValuesWebhook ConditionAlternative Method
Introduction
Using the Gravity Forms Webhooks Add-On is the easiest way to send requests to the WSDesk API to create support tickets when a form is submitted.
Note: This article assumes you have installed and activated the Webhooks Add-On and the WSDesk plugin. If not, you will need to do so before any of the functionality in this article can be used.
Setting Up the Form
Set up your form with the following fields and their labels: Single Line Text – Event Title, Paragraph – Event Description, Checkboxes – Event Options, Date – Start Date and End Date, Time – Start Time and End Time.
For the Checkboxes field, set these as the choices: All Day, Hide From Event Listings, Sticky in Month View, Feature Event
For the Time fields set up the Conditional Logic to Show field if Event Options is not All Day.
Configuring the Webhook
To configure webhooks for a form go to your Form Settings and click on the Webhooks tab and then click the Add New button.
Next, you』ll need to configure the request that is being made.
Name
Enter a name for your feed. This is never displayed and is only used for identification purposes. You can name this anything you want.
Request URL
The WSDesk endpoint for creating tickets is your site』s own Admin Ajax URL. The easiest way to include this URL is to enter the {admin_ajax_url} merge tag. It will be replaced with the correct URL when the feed is processed.
Request Method
Select the POST choice as the request method.
Request Format
Select the FORM choice as the request format.
Request Headers
We won』t be configuring any request headers.
Request Body
Select the Select Fields choice.
Field Values
Configure rows for the following fields, selecting Add Custom Value when configuring their values. Click the add item icon (+) to add new rows.
KeyValueactionwsdesk_api_create_ticketapi_keyThe WSDesk API key from the WSDesk > Settings > General tab
Next, you would configure additionals rows for the ticket fields which you have configured in WSDesk.
Enter the ticket field key (e.g. request_email) in the key input. For the values, you can select from the form fields, entry meta, or Add Custom Value which will display a text input that supports Merge Tags.
Webhook Condition
If ticket creation should be conditional based on the value of a form field, select the Enable Condition checkbox and then configure the rules which should be met for this request to be sent.
Alternative Method
If you don』t have an Elite or legacy Developer license and would prefer not to upgrade your existing license, you can still create tickets in WSDesk by using the gform_after_submission filter in your theme functions.php file or a custom functionality plugin.
See the How to use WSDesk create ticket API with third-party forms and plugins? article by WSDesk for more details.