Introduction
Webhooks are a powerful way to enable real-time communication between applications. By using webhooks, you can automate data transfer, streamline workflows, and ensure your contact information stays up-to-date. In Xendy, webhooks allow you to add new contacts or update existing ones by sending data directly from external applications like pop-ups, CRM systems, or newsletter forms. This seamless integration eliminates the need for manual imports and enables efficient, automated email marketing.
In this guide, we’ll walk you through how to use Xendy webhooks, provide examples of use cases, and explain how to configure your webhook integration for maximum effectiveness. Whether you’re collecting leads from a form or syncing customer data from another platform, Xendy’s webhook functionality simplifies the process.
Use cases of Xendy webhooks
Xendy webhooks offer flexible and efficient solutions for automating data transfer from various sources into your Xendy contact lists. Whether you’re managing leads from pop-ups or syncing data from a CRM, webhooks can streamline your workflows and ensure your contact database is always up-to-date.
1. Adding new contacts
Webhooks can be used to automatically add new leads or customers to your Xendy contact list. Common sources include:
- Pop-ups: connect your website pop-ups to Xendy to capture and store lead information seamlessly.
- Newsletter signup forms: automatically sync new subscribers with your Xendy contact database.
2. Updating existing contacts
Keep your contact information accurate by using webhooks to update existing records. For example:
- CRM integration: Sync updated customer details from your CRM to Xendy in real-time.
- Transactional data: Enrich existing contacts with data such as recent purchases or preferences.
3. Practical scenarios for webhooks
Here are some specific examples of how webhooks can be used with Xendy:
- E-commerce platforms: automatically add customers to Xendy after a purchase and trigger email automations such as order confirmations or post-purchase surveys.
- Event registration forms: sync attendees’ details to your Xendy list and follow up with reminders or event updates.
- Custom applications: use your own tools or scripts to push contact data into Xendy directly.
4. Real-time data flow
Webhooks ensure real-time data transfer, meaning contacts or updates appear in Xendy immediately after submission. This is especially valuable for time-sensitive workflows like follow-up emails or time-limited promotional campaigns.
By leveraging webhooks, Xendy helps you eliminate manual data entry, minimize errors, and maintain an up-to-date contact list. In the next section, we’ll explain how to send data to a Xendy webhook and ensure the integration is set up correctly.
Send data to the Xendy webhook
Once you’ve obtained your Xendy webhook URL, the next step is to send data to it. Xendy supports JSON-based data transfer, allowing you to automate the process of adding or updating contacts in your lists. This section will guide you through how to send data to the Xendy webhook using various methods, including examples for Curl, JavaScript, Python, and PHP.
1. Sending data to the webhook
Xendy webhooks accept JSON-formatted data sent via a POST request. Ensure the data includes:
- A valid email field (mandatory).
- Additional fields (optional), such as name, phone, or custom fields.
- A bearer token for secure authentication, if required.
2. Authentication
To secure your webhook requests, include a bearer token in the header. This ensures that only authorized systems can send data to your webhook. Example:
3. Examples of sending data
Here are examples of how to send JSON data to a Xendy webhook:
Using Curl
Using JavaScript (Fetch API)
Using Python (Requests library)
Using PHP
4. Testing your webhook
Before going live, test your webhook to ensure data is being sent and received correctly:
- Submit a test request using one of the examples above.
- Check Xendy by navigating to “All contacts” in the left menu and selecting the segment linked to your webhook.
- Verify that the submitted data appears correctly.
- Delete the test data afterward by selecting it and clicking “Delete.”
In the next section, we’ll explain how to map fields between your JSON data and Xendy’s contact fields to ensure seamless integration.
Field mappings
Field mapping ensures that the data sent to your Xendy webhook aligns with the fields in your Xendy contact database. Proper mapping guarantees that the data is stored accurately and can be used effectively in your email campaigns.
1. Understand Xendy’s field requirements
- Mandatory field:
- The email field is required for all submissions. Contacts without an email address will not be processed.
- Optional fields:
- Additional fields such as name, phone, or other custom fields can also be included to enrich your contact records.
- Custom fields:
- Xendy allows you to add new custom fields to capture unique data points specific to your use case.
2. Locate field names in Xendy
- Access field names:
- Log in to Xendy and navigate to the webhook URL page.
- Review the list of default field names (e.g., email, name, phone).
- Note any custom fields you’ve created.
3. Map JSON data to Xendy fields
When sending data to the webhook, ensure that your JSON keys match Xendy’s field names exactly. Examples:
- Default fields:
- Custom fields:
- If you’ve added custom fields in Xendy, include them in your JSON payload using their exact names. Example:
4. Add new fields in Xendy (optional)
If your JSON data includes fields not currently available in Xendy:
- Log in to Xendy.
- Go to the Contacts section and create a new field.
- Use the new field name in your JSON data for proper mapping.
5. Test field mappings
- Send a test submission:
- Use a tool like Curl, Postman, or your application to send a test JSON payload to the webhook URL.
- Verify in Xendy:
- Go to “All contacts” and select the segment associated with the webhook.
- Ensure the submitted data populates the correct fields.
6. Troubleshooting field mapping issues
- Missing data:
- Double-check that all JSON keys match the corresponding field names in Xendy.
- Unmapped fields:
- Verify that any custom fields in your JSON payload have been added to Xendy.
- Incorrect formatting:
- Ensure the JSON keys match Xendy’s field names exactly, including capitalization.
7. Tips for accurate field mapping
- Use descriptive names for custom fields to avoid confusion.
- Periodically review field mappings to ensure they align with any updates or changes to your Zap or Xendy contact list.
- Map only the necessary fields to keep your database clean and relevant.
With accurate field mappings, your data will integrate seamlessly into Xendy. In the next section, we’ll address frequently asked questions about using webhooks with Xendy.
Frequently asked questions
To get your webhook URL in Xendy:
- Log in to Xendy and go to “All contacts” in the left menu.
- Select an existing segment or create a new one by clicking “Add new segment.”
- Click “Add contacts” in the top-right corner and choose “Via webhooks.”
- Copy the displayed webhook URL.
You can send contact data such as:
- Mandatory field: email address.
- Optional fields: name, phone number, and any custom fields you’ve added in Xendy.
Yes, you can test the webhook by sending a sample JSON payload to the webhook URL.
- Submit test data using a tool like Curl or Postman.
- Go to “All contacts” in Xendy and select the segment associated with the webhook.
- Verify that the test data appears in the list.
- Delete the test data afterward by selecting it and clicking “Delete.”
If invalid JSON is sent:
- The webhook will return an error message.
- The contact will not be added or updated in Xendy.
- Check your JSON format and try again.
Yes, you can generate a unique webhook URL for each segment in Xendy. By using different webhook URLs, you can route contacts to specific lists.
No, Xendy does not impose limits on the number of webhook requests. You can send as many requests as needed without any restrictions.
Webhooks can be used for:
- Adding newsletter sign-ups to your Xendy contact list.
- Syncing leads from pop-ups or forms on your website.
- Updating contact information from a CRM system.
- Triggering automation workflows based on new data submissions.
If your integration isn’t working:
- Verify the webhook URL in your application matches the URL from Xendy.
- Ensure the email field in your JSON payload is correctly mapped.
- Submit test data and check the segment in Xendy under “All Contacts.”
- Fix any errors in your JSON payload and retest.
Yes, you can include custom fields by creating them in Xendy beforehand. Use the exact field names from Xendy in your JSON payload for proper mapping.
Use a bearer token for authentication. Include the token in the header of your requests to ensure only authorized applications can send data to your Xendy webhook.