Title: API setup
Last modified: May 7, 2018

---

# API setup

 *  Resolved [arjanwit](https://wordpress.org/support/users/arjanwit/)
 * (@arjanwit)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/)
 * Hi,
    I have multiple wordpress websites and only want to use the WPDesk on 1 
   install. How do I setup the other websites (through API) so I can submit tickets
   from other websites? Thank you! Regards, Arjan

Viewing 13 replies - 1 through 13 (of 13 total)

 *  [wsdesk](https://wordpress.org/support/users/wsdesk/)
 * (@wsdesk)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/#post-10253804)
 * Hi,
 * The following article will guide you on ‘How to use WSDesk create ticket API 
   with third-party forms and plugins? -> [https://wsdesk.com/use-wsdesk-create-ticket-api-third-party-forms-plugins/](https://wsdesk.com/use-wsdesk-create-ticket-api-third-party-forms-plugins/)
 * Hope this helps.
 *  Thread Starter [arjanwit](https://wordpress.org/support/users/arjanwit/)
 * (@arjanwit)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/#post-10253889)
 * Thank you,
    I added the snippet to the functions.php. Do I need to make special
   setup in my CF7 form? Meaning the email address of the wdesk account or a specific
   new CF7 form? This is not quite clear to me.
 *  [wsdesk](https://wordpress.org/support/users/wsdesk/)
 * (@wsdesk)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/#post-10253994)
 * Hi,
 * You don’t need to make any special setup in CF7 form. While you are setting up
   the contact form you will get the details that are to be filled in the snippet.
   Please see the screenshot attached-> [https://snag.gy/SFV5Me.jpg](https://snag.gy/SFV5Me.jpg)
 * Whatever details you give in the contact form should be same in the code snippet
   also.
 * If you have further doubts raise a support ticket [here](https://wsdesk.com/support/)
   so that we will have a screen sharing session and help you in setting up this.
 *  Thread Starter [arjanwit](https://wordpress.org/support/users/arjanwit/)
 * (@arjanwit)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/#post-10254222)
 * Okay cool.
    So can I also setup multiple CF7 forms? One that uses the snippet
   for tickets and onw to sign up for newsletters?
 *  [niladrixadapter](https://wordpress.org/support/users/niladrixadapter/)
 * (@niladrixadapter)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/#post-10254260)
 * Hi
    Yes, you can set up multiple forms. In the functions.php file, you can add
   the following snippet in the beginning of the function just to check if the submitted
   data is from the one you want to use as the support form.
 *     ```
       add_filter( 'wpcf7_posted_data', 'filter_wpcf7_posted_data', 10, 1 ); //filter to get posted data from the form );
   
       function filter_wpcf7_posted_data( $contact_form ) {
   
           // Not my desired form? bail
           if ( $contact_form->id !== $myform_id )
               return;
           //$myform_id is the ID of your desired form.
           // Do stuff for my contact form
       }
       ```
   
 * We can help you set it up via screen sharing if you face any trouble. Just raise
   an issue [here](https://wsdesk.com/support/).
    Thank you
 *  Thread Starter [arjanwit](https://wordpress.org/support/users/arjanwit/)
 * (@arjanwit)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/#post-10254282)
 * To be sure, do I replace the text myform_id by the ID?
    So $459 instead of $myform_id,
   or just replace $myform_id with the id 459
 *  [niladrixadapter](https://wordpress.org/support/users/niladrixadapter/)
 * (@niladrixadapter)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/#post-10254292)
 * Hi
    You need to replace $myform_id with the form ID. Please see the snippet below.
 *     ```
           if ( $contact_form->id !== 459)
               return;
           // continue with rest of the function here
       ```
   
 * Thank you
 *  Thread Starter [arjanwit](https://wordpress.org/support/users/arjanwit/)
 * (@arjanwit)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/#post-10254324)
 * Great it works, but I noticed there is no confimation page. After sending it 
   remains on the submission page.So is this the proper way then or should I put
   the other function right below in place to your text Do stuff for my contactform?
 *     ```
       // Addition voor CF7 Ticker formulier
       //
       add_filter( 'wpcf7_posted_data', 'filter_wpcf7_posted_data', 10, 1 ); //filter to get posted data from the form );
   
       function filter_wpcf7_posted_data( $contact_form ) {
   
           // Not my desired form? bail
           if ( $contact_form->id !== 459 )
               return;
           //$myform_id is the ID of your desired form.
           // Do stuff for my contact form
       }
   
       add_filter( 'wpcf7_posted_data', 'filter_wpcf7_posted_data', 10, 1 ); //filter to get posted data from the form
       function filter_wpcf7_posted_data( $posted_data ) { 
        $url="http://testtuin.dewitonline.nl/wp-admin/admin-ajax.php"; //Full URL of the admin-ajax file.
        $response = wp_remote_post($url,array(
        'method'=>'POST',
       'body' => array(
             'action'=>'wsdesk_api_create_ticket',
             'api_key' => '4adbf7954695625ea25a5deee3b4abd8',
             'request_email' => $posted_data['helpdesk-email'],
             'request_title' => $posted_data['helpdesk-subject'],
             'request_description'=>$posted_data['helpdesk-message'] )
        ));
   
       $response=json_decode($response['body'],true);
        if($response['status']=='success')
        {} //code if success
        else
        {} //code if fails
       };
       ```
   
 *  [niladrixadapter](https://wordpress.org/support/users/niladrixadapter/)
 * (@niladrixadapter)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/#post-10254351)
 * Hi
    The following code will not be in a different function. It will be at the
   begin of the one the main hooked function:
 *     ```
       add_filter( 'wpcf7_posted_data', 'filter_wpcf7_posted_data', 10, 1 ); //filter to get posted data from the form
       function filter_wpcf7_posted_data( $posted_data ) {
   
       //Not my desired form? bail
       if ( $contact_form->id !== 459 )
       return;
       //459is the ID of your desired form.
       // Do stuff for my contact form
   
        $url="http://testtuin.dewitonline.nl/wp-admin/admin-ajax.php"; //Full URL of the admin-ajax file.
        $response = wp_remote_post($url,array(
        'method'=>'POST',
       'body' => array(
             'action'=>'wsdesk_api_create_ticket',
             'api_key' => '4adbf7954695625ea25a5deee3b4abd8',
             'request_email' => $posted_data['helpdesk-email'],
             'request_title' => $posted_data['helpdesk-subject'],
             'request_description'=>$posted_data['helpdesk-message'] )
        ));
   
       $response=json_decode($response['body'],true);
        if($response['status']=='success')
        {
       //code if success
       }
        else
        {
       //code if fails
       }
       };
       ```
   
 * This all the code you will need to add in your function.php
    If you wish to do
   something after successfully submitting the form or do something in case of an
   error you can add your custom code instead of “//code if success” and “//code
   if fails” respectively. These lines are towards the end of function.
 * Thank You.
 *  Thread Starter [arjanwit](https://wordpress.org/support/users/arjanwit/)
 * (@arjanwit)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/#post-10254437)
 * I think I need some support with screenshare
    No tickets coming in at the moment
 *  [wsdesk](https://wordpress.org/support/users/wsdesk/)
 * (@wsdesk)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/#post-10254456)
 * Hi,
 * Please raise a ticket [here](https://wsdesk.com/support/). We will create a screen
   sharing session and share you the link to join.
 * After creating a ticket mention the ticket number here for our reference.
 *  Thread Starter [arjanwit](https://wordpress.org/support/users/arjanwit/)
 * (@arjanwit)
 * [8 years ago](https://wordpress.org/support/topic/api-setup/#post-10254470)
 * Request 5056
 *  [mthomas44](https://wordpress.org/support/users/mthomas44/)
 * (@mthomas44)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/api-setup/#post-10618179)
 * We have a google form that users fill-in to request help. I am trying to get 
   this data into WSDesk but cannot find a way for WSDesk to pickup the results 
   from either the form itself or the google sheet….
 * Anyone any ideas on how I can set this up?

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘API setup’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wsdesk_8cbad0.svg)
 * [WSDesk - Wordpress HelpDesk & Support Ticket System](https://wordpress.org/plugins/wsdesk/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wsdesk/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wsdesk/)
 * [Active Topics](https://wordpress.org/support/plugin/wsdesk/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wsdesk/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wsdesk/reviews/)

 * 13 replies
 * 4 participants
 * Last reply from: [mthomas44](https://wordpress.org/support/users/mthomas44/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/api-setup/#post-10618179)
 * Status: resolved