How to Set Up a Webhook in a HubSpot Workflow to Create a Letter Using Stannp API
Prerequisites
- API Key: Obtain your Stannp API key from your Stannp account.
- API Endpoint: Use the following endpoint for the webhook:
https://api-eu1.stannp.com/v1/letters/create
- Plan Requirements: Webhooks are available on HubSpot’s Professional or Enterprise plans.
- Permissions: You must have Super Admin permissions or sufficient access to workflows.
Steps to Create the Webhook
Step 1: Create or Open a Workflow
- Log in to your HubSpot account.
- Navigate to Automation > Workflows in the top menu.
- Create a new workflow or open an existing one.
- Select the type of workflow (e.g., contact-based, deal-based) and set enrollment triggers as needed.
Step 2: Add the Webhook Action
- Click the + button to add a new action in the workflow editor.
- Select Trigger a webhook.
Step 3: Configure the Webhook
Method and URL
- Set the Method to POST.
- Enter the following URL in the URL field, replacing
YOUR_API_KEY
with your Stannp API key:https://api-eu1.stannp.com/v1/letters/create?api_key=YOUR_API_KEY
Body
Construct the request body. Depending on your use case, include either the template
or, the file
parameter.
Example Body with Template:
{
"test": true,
"template": 12345,
"recipient": {
"title": "Mr.",
"company": "ABC Corp",
"firstname": "John",
"lastname": "Doe",
"address1": "123 Main Street",
"address2": "",
"city": "Barnstaple",
"postcode": "EX311JZ",
"country": "GB"
},
"tags": "invoice, priority",
"addons": "FIRST_CLASS",
"duplex": true,
"clearzone": true,
"post_unverified": false
}
Example Body with File Parameter:
{
"test": false,
"file": "https://example.com/sample_document.pdf",
"recipient": {
"firstname": "Jane",
"lastname": "Smith",
"address1": "456 Elm Street",
"city": "Barnstaple",
"postcode": "EX311JZ",
"country": "GB"
},
"tags": "contract, premium",
"duplex": false,
"addons": "FIRST_CLASS"
}
Step 4: Customize with HubSpot Tokens
To make the request dynamic, replace static values in the body with HubSpot property tokens. For example:
- Replace
recipient[firstname]
with Contact: First Name by clicking Insert token. - Repeat this for other fields like
recipient[lastname]
,recipient[address1]
, etc.
Step 5: Test the Webhook
- Click the Test button in the webhook configuration panel.
- Send a test request using sample data.
- Review the response from the Stannp API to confirm that the request was successful.
Step 6: Save and Activate the Workflow
- Once you’ve configured and tested the webhook, click Save.
- Turn the workflow ON to start automating letter creation.
Additional Notes
- Error Handling: If the webhook fails, check the response error in the workflow log. Common issues include missing required parameters or incorrect formatting.
- Testing Mode: Use the
test
parameter set totrue
for testing without actually sending a letter. - Dynamic Tokens: Use HubSpot tokens for personalized and dynamic content.
By following these steps, you can automate letter creation with the Stannp API directly from HubSpot workflows. For further assistance, contact your administrator or the Stannp support team.