Connecting other apps with Pendo using Zapier & Pendo custom metadata

Hi All,

I'm writing this to help the community with an issue you might have faced when integrating Pendo with Zapier. If you've ever tried to connect other apps to Pendo using Zapier, you may have noticed that the Pendo<>Zapier integration only allows you to use the Pendo Visitor/Account Report as a trigger to send data out, but not in.

The Problem:

Suppose you want to update custom metadata for a visitor or account in Pendo, but can't find a direct way to do so via Zapier.

The Solution:

You can solve this problem by using the "Code By Zapier" module to run a small JavaScript or Python script to update any custom metadata (single or multiple fields) for a visitor or account.

Requirements:

  1. The app you’re using as a trigger must provide you with either the visitor ID or account ID, which should also exist in your Pendo account and match exactly.
  2. You’ll need the internal name of the metadata fields you want to update (e.g., meta_data_field) and your Pendo integration key with write access permissions.

Setup Input Data First:

Setup the input data left side with the variables used in the example code (you will have to use your own metadata internal field names) below and the right side should be used to add the data from your trigger app, refere the attached image below.

Example Zapier Code (Python):

Below is a Python snippet you can use in the "Code by Zapier" action to update custom metadata for a visitor (or account) in Pendo.

import requests
import json

# Retrieve input data from the trigger app
# Update metadata for a visitor or account
visitor_id = input_data.get('visitorid', '')  # Visitor ID
# account_id = input_data.get('accountid', '')  # Uncomment for account metadata

integration_key = input_data.get('integration_key', '')
meta_data_field_value_1 = input_data.get('meta_data_field_value_1', '')
meta_data_field_value_2 = input_data.get('meta_data_field_value_2', '')
meta_data_field_value_3 = input_data.get('meta_data_field_value_3', '')
meta_data_field_value_4 = input_data.get('meta_data_field_value_4', '')

# Pendo API endpoint to update visitor metadata
url = "https://app.pendo.io/api/v1/metadata/visitor/custom/value"
# Uncomment this if updating account metadata:
# url = "https://app.pendo.io/api/v1/metadata/account/custom/value"

# Prepare the payload with the input data
payload = json.dumps([
    {
        "visitorId": visitor_id,  # Replace with accountId if updating account metadata
        "values": {
            "meta_data_field_1": meta_data_field_value_1,
            "meta_data_field_2": meta_data_field_value_2,
            "meta_data_field_3": meta_data_field_value_3,
            "meta_data_field_4": meta_data_field_value_4
        }
    }
])

# Set the headers for the request
headers = {
    'content-type': 'application/json',
    'x-pendo-integration-key': integration_key
}

# Make the POST request to update metadata
response = requests.post(url, headers=headers, data=payload)

# Output the response from the API
output = {'response': response.text}

Key Points:

  • Replace visitorId with accountId if you want to update metadata for an account instead of a visitor.
  • Ensure the metadata field names (e.g., meta_data_field_1) are the internal names used in your Pendo setup.
  • The integration_key is mandatory for authentication with Pendo's API.

Feel free to use this script to easily update your custom metadata via Zapier when a specific trigger fires from another app!

1

コメント

0件のコメント

サインインしてコメントを残してください。

お探しのものを見つけられませんでしたか?

新規投稿