Webhook

Purpose of this building block

With webhooks you can call an arbitrary URL from Ultradox to retrieve data from other services.

0 variables
0 variables

You can specify the URL, the request method (POST or GET), the header fields and the authentication method.

When selecting POST method the data model of your Ultradox file that holds all the variables will be sent to this URL in the body of the request in JSON format.

You can create a custom request body instead by simply typing your body into the provided text field. In the body you can use all Ultradox variables and formatting options to exactly specify the format that your server expects.

If the result is provided in valid JSON format, the returned data is available as new variables that can then be used in the subsequent building blocks or in your templates.

Possible use cases

  • Call 3rd party services from Ultradox

Configuration

Click on the bold name of the webhook in the building block title to open the configuration dialog.

Option

Description

Name

Enter the name of the webhhok that will be displayed in the title of the building block.

URL

Enter the URL of the endpoint you want to call.

Headers

You may want to send header fields with your request.

Header keys and values must be separated with a colon. If you want to pass multiple headers, separate them by a comma.

Use variables to pass the desired data in your headers. Example:

X-PW-AccessToken:${pwAccessToken},X-PW-Application:developer_api

Body

You can specify the request body if you are using the POST method to send the request.

Use variables in your body to pass the desired data. Example:

{
        'email' : '${currentUser.email}',
        'name' : '${currentUser.displayName}'
}

API definition

You may want to describe the API that you are calling so that the fields show up as variables in the auto-completion in Ultradox as well as in the template editor and email designer add-ons for Google Docs.

Example:

{
    input : [
          { name : 'rows',
            prompt : 'Enter the number of rows to be created:',
            description : 'Number of rows to be created',
            defaultValue: '5',
            format : 'NUMBER',
            required : true
          },
          { name : 'minAge',
            prompt : 'Enter the minimum age of the users:',
            description : 'Minimum age',
            defaultValue: '21',
            format : 'NUMBER',
          }
    ],
    // Note that square brackets indicate an array
    output : [
          { name : 'users[].name',
            description : 'Contains the given name of the user',
            format : 'STRING'
          },
          { name : 'users[].age',
            description : 'Contains the age of the user',
            format : 'NUMBER'
          },
          { name : 'maxAge',
            description : 'Contains the age of the oldest user',
            format : 'NUMBER'
          }
    ]
}

URL of API definition

Optionally you can serve the definition of the API in the same format as above from your server.

Just enter the URL that will return the API definition.

Useful combinations

Stripe Invoicing (simplified)

The business information of the invoicing company as well as the payment information itself is loaded from Stripe using a web-hook. To load any information via the Stripe API the customers Stripe secret key needs to be entered (not shown in this simplified example).

stripeAccessKey
businessAddress
stripeAccessKey
customerCountry
customerAddress
customerPayment
customerCountry
customerVAT
customerCountry
templateFileId
invoiceNumber
invoicePDF
businessAddress
customerAddress
customerPayment
customerVAT
invoicePDF
EMAIL

Once the data is loaded from Stripe the Ultradox flow uses as custom script to calculate the correct VAT depending on the customers country of origin.

The country is also used to find the correct invoice template in the right language.

Each invoice in stripe has a unique identifier. Ultradox generates a unique invoice number based on this identifier.

All information is then used in the templates for the PDF invoice and the outgoing email. Finally the invoice document is send to the customer by email.

Copy the Invoicing For Stripe app to see this building block in action

Questions and Feedback

If you have any comments on this guide, feel free to add them right to the Google document that we are using to create this site.

If you are not yet member of the Ultradox community on Google+, please join now to get updates from our end or to provide feedback, bug reports or discuss with other users.

Last Updated:

Share on Google+Share on FacebookShare on TwitterShare on LinkedIn