Web Form Autoresponder

    Get Web Form Autoresponder Details

    Get autoresponder.

    Note: This operation does not support: pagination, filtering, or sorting parameters.

    Request

    • Method: GET
    • Server: https://[app key here]-[site_ID here]-apps.worldsecuresystems.com. Take a look at the Authorize your API calls document for more info on how this URL is formed.
      • Note: When building apps always use relative request URLs. Do not use the "full" URL above because you might have problems running your app on a different site as the site_ID parameter will be different.
    • Path: /api/v1/admin/sites/[site_ID]/webforms/[webform_ID]/autoresponder
      • Alternatively use "current" in place of site_ID for current login token's site
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.
    • Accept header: application/xml or application/json

    Response

    An object with the following properties:

    • fromName - name of the sender (string)
    • fromEmail - email of the sender (string)
    • subject - autoresponder subject (string)
    • body - body of the email(string)
    • format - body format (integer)
      • 1 - HTML
      • 2 - Text
    • templateId - template ID (integer)

    Accepts and returns JSON as Content-Type.


    Sample request

    GET /api/v1/admin/sites/current/webforms/10851/autoresponder
    Authorization: 7e04176165cd4df7b628cc8ad022a8becf3bb84de44d480aadfae75e4fa07b56
    Content-Type: application/json

    Sample response

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "fromName": "John Doe",
      "fromEmail": "john@mysite.com",
      "subject": "Thank you for your enquiry",
      "body": "This is the body of the message",
      "format": 2,
      "templateId": -1
    }

    Sample code

    var request = $.ajax({
        url: "/api/v1/admin/sites/current/webforms/10851/autoresponder",
        type: "GET",
        headers: {
            "Authorization": $.cookie('access_token')
        },
        contentType: "application/json"
    });
    request.done(function (msg) {
        console.log('Request successful, response is: ')
        console.log(msg);
    })
    request.fail(function (jqXHR) {
        console.log("Request failed. Error code: " + jqXHR.status);
    })

    Edit a Web Form Autoresponder

    Update autoresponder details of a web form.

    Request

    • Method: PUT
    • Server: https://[app key here]-[site_ID here]-apps.worldsecuresystems.com. Take a look at the Authorize your API calls document for more info on how this URL is formed.
      • Note: When building apps always use relative request URLs. Do not use the "full" URL above because you might have problems running your app on a different site as the site_ID parameter will be different.
    • Path: /api/v1/admin/sites/[site_ID]/webforms/[webform_ID]/autoresponder
      • Alternatively use "current" in place of site_ID for current login token's site
    • Authorization header: This should contain the authorization token. Here is how to obtain the token.
    • Accept header: application/xml or application/json

    Parameters

    • fromName - name of the sender (string)
    • fromEmail - email of the sender (string)
    • subject - autoresponder subject (string)
    • body - body of the email (string)
    • format - body format (integer)
      • 1 - HTML
      • 2 - Text
    • templateId - template ID (integer)

     

    Response

    Returns an empty body if successful or a detailed error message.

    Accepts JSON or XML as Content-Type.

    HTTP/1.1 200 OK
    Content-Length: 0

    Sample request

    var access_token = BCAPI.Helper.Site.getAccessToken();
    
    var request = $.ajax({
        url: "/api/v1/admin/sites/current/webforms/10851/autoresponder",
        type: "PUT",
        connection: "keep-alive",    
        contentType: "application/json",headers: {
            "Authorization": $.cookie('access_token')
        },   
        processData: false,
    	data: JSON.stringify({
          "fromName": "John Doe 2",
          "fromEmail": "office@mysite.com",
          "subject": "Thank you for your email",
          "body": "<p style=\"font:10pt arial;\">Dear {tag_recipientname},<br/><br/>\r\nThank you for reaching out to us via our website;  we'll be in touch as soon as we can. <br/><br/>\r\n{tag_webformresults}\r\n</p>",
          "format": 1,
          "templateId": -1
        })
    });
    request.done(function (msg) {
        console.log(msg);
    });
    request.fail(function (jqXHR) {
        console.log("Request failed.");
        console.log("Error code: " + jqXHR.status);
        console.log("Error text: " + jqXHR.statusText);
        console.log("Response text: " + jqXHR.responseText);
    });