• Resolved arjanwit

    (@arjanwit)


    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)
  • 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/

    Hope this helps.

    Thread Starter arjanwit

    (@arjanwit)

    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.

    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

    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 so that we will have a screen sharing session and help you in setting up this.

    Thread Starter arjanwit

    (@arjanwit)

    Okay cool.
    So can I also setup multiple CF7 forms?
    One that uses the snippet for tickets and onw to sign up for newsletters?

    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.
    Thank you

    Thread Starter arjanwit

    (@arjanwit)

    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

    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

    (@arjanwit)

    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="https://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
    };

    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="https://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

    (@arjanwit)

    I think I need some support with screenshare
    No tickets coming in at the moment

    Hi,

    Please raise a ticket here. 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

    (@arjanwit)

    Request 5056

    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.