Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Campaign smart functions

Reading contact metadata and storing the call result from the conversation flow.

Two smart functions connect the conversation flow with the campaign. Add them in a Function node (or the Start node) via Smart functions > Add smart function, and store their output in a variable.

Smart function
Use it to

Get campaign call metadata (get_campaign_call_metadata)

Load the contact's data (metadata) at the beginning of the call.

Update campaign call result (update_campaign_call_result)

Save the result of the call and decide whether the contact is called again.

Both functions work only in conversations started by a campaign (or in a call-back from a campaign contact, see below).

get_campaign_call_metadata

Returns the campaign record of the contact, including all columns from the uploaded file.

Argument
Required
Description

Phone number (phone_number)

yes

The contact's phone number. On an outbound call it is available in the PhoneNumber variable.

Number of days for user callback (days)

no

Default 2. See Call-backs below.

Output - stored e.g. in the variable campaign_call:

The uploaded columns are under metadata > metadata. Read them into separate variables, e.g.:

  • New variable name: first_name New variable value: campaign_call["metadata"]["metadata"]["first_name"]

and use them in messages: "Good morning {first_name}, I am calling about contract {contract_id}."

Other useful fields: attempt (which attempt this is - e.g. a different greeting on a repeated call) and status (result of the previous attempt).

If the data cannot be loaded, the function returns an empty object {}. Make sure the flow continues sensibly in that case (e.g. a generic greeting without the name).

Call-backs

When a contact misses the call and calls back to the voicebot number, the inbound conversation has no campaign link. The function then searches the caller's conversations from the last days days (within the same organisation) and, if it finds the campaign call, returns its data. The flow can then finish the original task and save the result with update_campaign_call_result - a successful result also marks the contact as Processed.

update_campaign_call_result

Saves the result of the call to the campaign.

Argument
Required
Description

Status (status)

yes

Final status of the call, e.g. interested, not-interested, callback-requested, busy.

Call metadata (metaData)

no

Dictionary with data to store with the call, e.g. {"agreed": "yes", "preferred_date": "2026-10-20"}. The values also become variables in the conversation.

Custom retry delay (min) (custom_retry_delay)

no

Minutes until the next attempt for this contact - overrides the campaign setting for this one retry. Used only when the status is unsuccessful.

What the status does

  • Status listed in the campaign's Statuses, or busy / no-answer / disconnected → unsuccessful: the contact is called again (or moved to Failed if no attempts are left).

  • Any other status → success: the contact is moved to Processed.

Output - a text message:

Output
Meaning

200 - Successfully updated

The result was saved.

501 - Metadata was updated but status_callback_url was not provided

The conversation is not a campaign call - only the variables were updated.

500 - Error while updating call ...

The result could not be saved.

Call update_campaign_call_result on every path where a connected call ends (success, refusal, transfer to an operator...). If no result arrives, the platform checks the conversation's call_result variable after 10 minutes and otherwise marks the contact as failed after 60 minutes.

Last updated

Was this helpful?