Create Custom Actions

  • Updated

Create Custom Actions to configure an HTTPS API request that sends Account or People data to a partner system, or to build Automations that trigger events in the partner’s system. Custom Actions work with out-of-the-box integrations for Marketo, HubSpot, and Salesforce, as well as Custom Integrations.

Important:

  • Custom Actions supports any API that uses HTTPS.
  • To change status, edit, or delete Custom Actions, see Manage Custom Actions.

Prerequisites

You must have access to Demandbase One for Marketing.

Step 1: Create an Integration

You must have an integration configured before creating a Custom Action:

Step 2: Create 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 an Integration for this action.
  4. Enter an Action Name.
  5. Enter an Action Description.
  6. In Member Type, select the object the action targets: Accounts or People.
  7. In HTTPS Request, specify the HTTPS method (GET, POST, PUT, PATCH, or DELETE) and the endpoint URL where the request is sent.
    Important: For Salesforce, Marketo, and HubSpot integrations, enter only the relative path (e.g., /api/v1/...). Do not include the base URL/domain - it’s supplied by the configured integration.
    • (Optional) To add records to a Demandbase static list, toggle on Enable Pushing Lists and enter the Variable Name (list label). This allows you to save the records from a Custom Action into a static list for reuse in other workflows or analysis.
      Important: You can only add records to static lists.
  8. In Request Body, enter the data to be sent with the HTTP request in JSON format.
    Tip: For examples, see Request Body Examples.
    • Use Jinja syntax within the JSON to reference Demandbase fields as variables and insert dynamic values.
    • For key–value pairs:
      • Keys should match the parameter names defined in the API documentation.
      • Values should be set using Demandbase fields.
  9. (Optional) In Headers, you can add custom headers to be included in the request.
    Important: Variables are not supported here.
  10. Click Create Action.

Next Steps

Request Body Examples

The Request Body supports Jinja Templates. Use Jinja syntax in JSON values to insert dynamic data.

Reference Object Fields inside Variables

{
  "name": "{{Person.name}}"
}
  • {{ ... }} outputs the value of a variable.
  • Person.name reads the name field from the Person object.
  • When the action runs, {{ Person.name }} is replaced with the person’s actual name.

Filter Referenced Object Fields inside Variables

Use filters to modify variables. Filters are separated from the variable by a pipe symbol (|).

{
  "name": {{Person.lastName | capitalize}}
}
  • capitalize makes the first of the Person’s last name uppercase

Set Conditions on Value

Use if statement to test if a variable is defined, not empty and not false:

{%- if Person.name -%}
  { "name": "{{ Person.name }}" }
{%- else -%}
  { "name": "Unknown" }
{%- endif -%}
  • Checks to see if the name field in the Person object exists. If it does, return it. If it doesn’t return “Unknown”.

Create JSON Array Dynamically

Use the set tag and for loops to dynamically create a JSON object.

{%- set names = Account.contacts -%}
{
   "id": "{{Account.id}}",
   "names": [
     {%- for contact in names -%}
       { "name": "{{ contact.name }}" }{{ "," if not loop.last }}
     {%- endfor -%}
   ]
}
  • {%- set names = Account.contacts -%} sets the names variable to the list of contacts associated with the Account.
  • "id": "{{Account.id}}" references the account's unique Id.
  • {%- for contact in names -%} is a for loop that iterates through each contact object in the names list.
  • { "name": "{{ contact.name }}" } inside the loop accesses the name attribute of each contact object to generate the JSON entry.
  • {{ "," if not loop.last }} is a conditional statement that adds a comma after each object in the array, except for the last one.
  • {%- endfor -%} marks the end of the for loop.

Full Request to Send a Slack Message

Here is a complete request body example when using the slack API to post a message via https://slack.com/api/chat.postMessage endpoint.

{
  "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 }}"
}

Was this article helpful?

0 out of 0 found this helpful