Skip to main content
Loading...
Skip to article
  • Qualtrics Platform
    Qualtrics Platform
  • Customer Journey Optimizer
    Customer Journey Optimizer
  • XM Discover
    XM Discover
  • Qualtrics Social Connect
    Qualtrics Social Connect

Web Service Task


Was this helpful?


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The feedback you submit here is used only to help improve this page.

That’s great! Thank you for your feedback!

Thank you for your feedback!


About the Web Service Task

The Web Service task is useful if you are adept at API and would like to trigger different workflows within the Qualtrics software, or to an external web service, when the respondent finishes the survey. For example, if your survey collects the respondent’s contact information, then a web service task can use the create contact API call to add the respondent to a contact list.

We also recommend visiting these web service-related pages for more assistance and background:

Qtip: This page contains references to Qualtrics’ API, which is a feature that requires special permission to access. If you are interested in obtaining access to this feature, please reach out to your Brand Administrator for more information.
Attention: Setting up a web service often requires advanced programming knowledge. Although our support team is happy to help with the basics of putting information into the web service, we cannot provide support on the programming aspects.
Attention: Web Service tasks only support the following content types: URL-Encoded, XML, JSON, and Plain Text.

Setting Up a Web Service Task

Depending on how you prefer to format your body parameters, the setup will slightly differ. If you are using JSON or XML format, enter your body in the Body section. If you’d prefer URL-Encoded, you can add parameters as a query string to the URL field.

  1. Create a workflow (or select an existing one) in your project or in the stand-alone Workflows page.
    In the workflows tab, clicking "create a workflows" and then "started when an event is received"
  2. Make sure you’re in the Your workflows section.
  3. Click Create a workflow.
  4. Determine the schedule or the event that triggers your task. (See a comparison.)
  5. Click Add task and select WebService.
    the webservice event
  6. Choose your authentication method. Your options include:
    choosing the authentication type and clicking next

    • Authenticated: Perform an authenticated web service request. Your authentication options include basic (with a password and username), API key, and OAuth.
    • Non-authenticated: Perform a web service request without authentication.
  7. Click Next.
  8. If you selected an authenticated request, select your authorization credentials from the list, or click Add User Account to add new credentials. See Adding Authorization Credentials for more information.
    adding a user account, or choosing an existing one

    Qtip: You’ll be able to select any credentials you’ve previously added, or credentials added by a Brand Administrator in the Extensions tab.
  9. Click Next.
  10. If desired, add a Task summary at the top of your task. This is a description explaining the goal of the task.
    Task summary field at the top of the WebService window
  11. Choose your web service’s Request method. See Web Service Methods for more information about each method.
    choosing the request and entering a URL

    Qtip: If you’re using the Qualtrics API, the documentation will tell you what type of request to use.
    Attention: WebService tasks do not allow any URL redirects for non-GET requests. Only one redirect is allowed for GET requests.
  12. Enter the URL for your request.
    Qtip: You can limit the domains that the web service task can connect to by specifying the domains in your extension domain settings.
  13. If desired, click Add header to add a header. Specify the Key and Value. To remove a header, click the trash can icon next to the header.
    Qtip: Use the piped text icon, {a}, to insert piped text to pull in values from survey responses or previous tasks in the workflow.
    Attention: If using the Qualtrics API, you must include your API token through the header. See Adding a Header for Qualtrics API Requests for more information.
    Attention: For POST, PUT, and PATCH requests you must specify a data type for each key-value pair.
    Attention: Web service tasks do not currently support comments/text in the body that contains escape sequences.
  14. If you chose post, put, or patch, you’ll need to choose the format of your body. Options include JSON, URL-Encoded, XML, and Plain Text.
    adding body parameters into the web service, then adding a key-value pair to the body request

    Qtip: Plain Text can only be specified as Free text. When using the JSON Free text option, inputs are not escaped. This means that, for example, a piped text input containing double quotes or newline characters (example: \n) will cause the JSON body to become invalid and not run properly. An alternative to this is to use either the key-value pairs option or use a code task to clean or escape the text to be injected into the web service task.
  15. Determine how you want to specify the body of your request. You can add the body as Key-value pairs or Free text.
  16. If you selected Key-value pairs, add the Key and its associated Value. Click Add key-value pair to add additional parameters.
  17. Select a Data type.
    • Boolean: Select this data type if your data has one of two possible values.
    • JSON: Select this data type if your data is in JSON format.
    • Number: Select this data type if your data is numeric.
    • String: Select this data type if your data is in text format.
    • System Default: Select this data type if you want to use the native data type for your data. If a data type cannot be found this will default to the String type.
      Qtip: We recommend selecting one of the other data types to ensure your data is cast correctly.
      Attention: Key-value pairs that were configured before September 16, 2022 will have a data type of System Default.
    Qtip: The Data type field is only available when you select JSON and Key-value pairs in steps 13-14.
  18. Select what happens if the data type cannot be cast.
    • Do not cast a data type, and flag as an error: If the data type cannot be cast, no data type will be cast and the task will fail. This can be seen in the Run History tab.
    • Cast the data type to system default: If the data type cannot be cast, the data type will be set to System Default.
  19. If you selected Free Text, enter your body parameters in your selected format.
    Body set to free text, so instead of key value pairs, there's a big text field
  20. To test your web service, click Run test.
    run test button. section named piped text where you add JSON paths

    Qtip: After clicking Run test, the result of your request will appear, letting you know if it was successful or not, and the resulting JSON or XML, if it was successful.
  21. Click Add custom path to add JSON or XML paths. These paths let you use the results of your web service in piped text, to be used with other tasks in your workflow, such as a code task. If you tested your web service, you may automatically have values here, as Qualtrics will automatically pull them out of the results.
    Qtip: Click Add custom path to add additional paths, or click the trash can next to a path to delete it.
  22. When finished setting up your workflow, click Save.
Qtip: Web service tasks have a 16 second timeout. If a call to the web service takes longer than 10 seconds, the workflow will fail.

Adding Authorization Credentials

This section covers how to add authorization credentials for the web service task. You can add credentials using the Basic, API Key, or OAuth 2.0 method. To add credentials, click Add user account from the credential selection window.

Qtip: All connection types are compatible with mTLS. To learn more, see the Mutual TLS section.

Basic

Basic authentication requires you login with your account’s username and password.

adding a new basic authentication account

  1. Give your credentials a Name. This is for your organizational purposes only.
  2. Choose Basic as the connection type.
  3. Enter the Username required for authentication.
  4. Enter the Password for authentication.
  5. Click Connect account.

API Key

API Key authentication allows you to authenticate using a static API token.

adding a new api account

  1. Give your account a Name. This is for your organizational purposes only.
  2. Choose API key as the connection type.
  3. Enter the API Token used for authentication.
  4. Click Connect account.

OAuth 2.0

OAuth2.0 authorization removes the need to use static API tokens or basic username and password to integrate with 3rd-party platforms. The web service task supports two different OAuth2.0 authorization types: authorization code and client credentials.

You can use OAuth 2.0 authorization to integrate seamlessly with many 3rd-party platforms. The Qualtrics web service implementation follows the official OAuth specification. However, some external systems may have slightly different configurations leading to incompatibilities with OAuth2.0 authorization in the web service task.

The following integrations are some examples that have been fully verified to work with OAuth2.0:

  • Salesforce using the authorization code method.
  • Jira using the authorization code method.
  • Zoom using the authorization code method.
Qtip: When creating an OAuth connection, the redirect URL will be https://{dataCenter}.qualtrics.com/oauth-client-service/redirect, where {dataCenter} represents the value associated with your account. See this page for more details on finding your account’s datacenter.

To authenticate using OAuth 2.0:

adding a new oauth account

  1. Give your account a Name. This is for your own organizational purposes only.
  2. Choose OAuth as the connection type.
  3. Choose your Grant type, or how the access token is retrieved. You may choose:
    • Authorization code
    • Client credentials
  4. Enter the Client ID and Client secret.
  5. Enter the Token endpoint.
  6. If you selected authorization code as the grant type, enter the Authorization endpoint.
  7. Click Connect account.
Qtip: For users setting up Google OAuth credentials, include the following parameter at the end of your Token Endpoint: ”?prompt=consent.” If you have existing query parameters, the question mark is not necessary.

Renaming & Removing Credentials

To edit your credential’s name, click the three dots next to the account. To remove credentials, click Remove account.
the rename and remove button next to an account

Qtip: You can only rename or remove credentials you’ve added yourself.
Warning: Be careful when deleting credentials! Any workflows that use the credentials will stop working when the credentials are deleted.

Adding a Header for Qualtrics API Requests

When using the Qualtrics API, you must include your API token as a header in your web service.

  1. Set up your web service task, select your credentials, and choose your request.
    adding an api token as a header
  2. In the Headers section, enter X-API-TOKEN as the Key.
  3. For the value, click the piped text icon, {a}.
  4. Select your credentials from the list.
    selecting the API token field for the token header

Mutual TLS

Mutual transport layer security (mTLS) is an additional, optional layer of security on top of standard API authentication mechanisms (such as API Token or OAuth). Mutual TLS ensures both the person connecting to an API / web service and the API / web service itself have secure, encrypted traffic in both directions. Once mTLS is enabled, all requests must present the correct client certificate for requests to succeed. If a caller makes a request using an invalid or missing client certificate, the API they are trying to call will block the request.

Requirements

Every service varies in whether it supports mTLS and what format(s) it provides key information in. We are only guaranteed to support mTLS for services whose match our requirements:

  • Provide a private key
  • Private key can be formatted into PKCS8
  • Provide a certificate
  • Certificate can be formatted into X.509

The Qualtrics public APIs support mTLS as described above.

mTLS is only supported for Authenticated web services created in workflows. All three authentication methods are supported (Basic, API key, and OAuth2.0).

Adding mTLS

  1. Create your web service task.
    Selecting a web service task
  2. Choose Authenticated.
    Next window shows two options: authenticated and non-authenticated web service
  3. Click Next.
  4. Add a user account.
    Button for adding user accounts in upper-left of next page of window

    Qtip: A Brand Administrator can connect to an account using the Extensions page.
    Showing webservice extension on the extensions tab of the admin page
  5. Select a connection type and fill out your credentials.
    web service credentials
  6. Select Enable mTLS.
  7. The Private key can be thought of as the unique identifier of the client trying to connect. This value needs to be in PKCS8 format.
    Qtip: If your key is in a different format, you can change use another program to change this format.
    Qtip: If you’re planning to use the Qualtrics API with your web service, see our API Documentation on mTLS. This documentation will show you how to pull the private key. When you paste the value in Qualtrics, you will need to include dashes that say “begin private key” and “end private key.”
  8. The Public key is the mTLS certificate. This value needs to be in X.509 format.
    Qtip: If you’re planning to use the Qualtrics API with your web service, see our API Documentation on mTLS. This documentation will show you how to pull the certificate. When you paste the value in Qualtrics, you will need to include dashes that say “begin certificate” and “end certificate.”
  9. When you’re finished, click Connect Account.
  10. Proceed with your web service’s setup.
Qtip: The validity of your mTLS keys cannot be tested until you run an API call through your web service, so you will not see an error message on this page if you entered your keys incorrectly. Try testing the web service before you make your workflow live.

FAQs