Create Custom Actions

  • Updated

Create Custom Actions to send Account or People data to partner systems through HTTPS API requests. You can run Custom Actions manually or use them in Automations to trigger events in partner systems.

Custom Actions support Salesforce, Marketo, and HubSpot integrations, as well as Custom Integrations.

Important:

  • Custom Actions support any API that uses HTTPS.

  • To change the status of, edit, or delete Custom Actions, see Manage Custom Actions.


Prerequisites to Create a Custom Action


Create a Custom Action

  1. From the left navigation bar, go to Settings_N.png Settings > Integrated Systems > Custom Action Configurations.
  2. Click Create New.
  3. Select the Integration to use for the action.
  4. Enter an Action Name and Action Description.
  5. In Member Type, select Accounts or People to specify the records the action targets.
  6. In HTTPS Request, select the request method (GET, POST, PUT, PATCH, or DELETE) and enter the endpoint URL.
    Important: For Salesforce, Marketo, and HubSpot integrations, enter only the relative path (for example, /api/v1/...). The configured integration provides the base URL.
  7. (Optional) To save records to a Demandbase static list, turn on Enable Pushing Lists and enter the Variable Name (list label). You can reuse the list in other workflows or analyses.
    Important: You can only add records to static lists.
  8. In Request Body, enter the data to send in JSON format. You can:
    • Use Jinja syntax to insert dynamic values from Demandbase fields.
    • Specify JSON keys that match the parameter names in the partner API documentation.
    • Set JSON values using Demandbase fields.
      Tip: For Jinja syntax examples, see Request Body Examples.
  9. (Optional) In Headers, add custom headers to include in the request.
    Important: Headers do not support variables.
  10. Click Create Action.

Run Custom Actions Manually or with Automations

After creating a Custom Action, you can:


Request Body Examples

The Request Body supports Jinja templates. Use Jinja syntax to insert dynamic Demandbase data, modify values, apply conditions, and create JSON arrays.

Reference Demandbase Object Fields in Variables

Use double curly braces ({{ }}) to insert values from Demandbase object fields.

{
  "name": "{{Person.name}}"
}

In this example:

  • {{ }} outputs the variable value.
  • Person.name references the name field of the Person object.
  • When the action runs, Demandbase replaces {{ Person.name }} with the person's name.

Apply Filters to Demandbase Object Fields

Use Jinja filters to modify variables to modify variable values. Separate the variable and filter with a pipe (|).

{
  "name": {{Person.lastName | capitalize}}
}

The capitalize filter capitalizes the first character of the person's last name and converts the remaining characters to lowercase.

Set Conditional Values in the Request Body

Use Jinja if statements to set values based on whether a field contains a value.

{%- if Person.name -%}
  { "name": "{{ Person.name }}" }
{%- else -%}
  { "name": "Unknown" }
{%- endif -%}

This example:

  • Checks whether Person.name contains a value.
  • Uses the person's name if the value exists and evaluates to true.
  • Uses Unknown if the value is missing, empty, or evaluates to false.

Create JSON Arrays Dynamically

Use Jinja set statements and for loops to create JSON arrays from Demandbase data.

{%- set names = Account.contacts -%}
{
   "id": "{{Account.id}}",
   "names": [
     {%- for contact in names -%}
       { "name": "{{ contact.name }}" }{{ "," if not loop.last }}
     {%- endfor -%}
   ]
}

In this example:

  • {% set names = Account.contacts %} assigns the account's contacts to the names variable.
  • {{ Account.id }} inserts the account ID.
  • {% for contact in names %} loops through the contacts.
  • {{ contact.name }} inserts each contact's name.
  • {{ "," if not loop.last }} adds commas between array items, but not after the last item.
  • {% endfor %} ends the loop.

Send a Slack Message Using a Custom Action

The following example uses the Slack chat.postMessage API to send a notification when a new lead is captured.

Configure the Custom Action to use the POST method with the endpoint https://slack.com/api/chat.postMessage and the appropriate Slack authentication.

When the Custom Action runs, Demandbase replaces the Jinja variables with the corresponding Person field values and sends the request to Slack.

{
  "channel": "lead-news", 
  "blocks": [
    {
      "type": "header",
      "text": {
        "type": "plain_text",
        "text": "📩 New Lead Captured!",
        "emoji": true
      }
    },
    {
      "type": "section",
      "fields": [
        {
          "type": "mrkdwn",
          "text": "*👤 Name:* {{ Person.name }}"
        },
        {
          "type": "mrkdwn",
          "text": "*💼 Title:* {{ Person.title }}"
        },
        {
          "type": "mrkdwn",
          "text": "*🏢 Company:* {{ Person.company }}"
        },
        {
          "type": "mrkdwn",
          "text": "*📧 Email:* {{ Person.email }}"
        },
        {
          "type": "mrkdwn",
          "text": "*🌍 Location:* {{ Person.address }}"
        }
      ]
    },
    {
      "type": "actions",
      "elements": [
        {
          "type": "button",
          "text": {
            "type": "plain_text",
            "text": "✉️ Send Email"
          },
          "url": "mailto:{{ Person.email }}"
        }
      ]
    }
  ],
  "text": "New lead received: {{ Person.name }} from {{ Person.company }}"
}