BLACK FRIDAY: extra 40% off everything with code BLACKFRIDAY. Each customer can use it only once, so use it on a bundle to save the most. Bundles skip plugins you already own. Ends November 30.

NEXTPION - AI Function Calling

Enable AI to use tools and execute functions for enhanced capabilities. Includes web search, time utilities, subscriber label management, sequence campaign management, and an extensible tool framework with per-tool AI instructions.

NEXTPION - AI Function Calling DLC Cover

This guide covers the NEXTPION - AI Function Calling DLC, which extends the AI Integration Enhancers plugin to let AI call tools and execute functions — including web search, time queries, subscriber label management, and sequence campaign management — turning your AI from a text-only chatbot into an action-capable assistant.

NEXTPION - AI Function Calling

NEXTPION - AI Function Calling is a DLC expansion for the AI Integration Enhancers plugin. By default, the AI can only generate text replies. This DLC gives your AI the ability to call tools and execute real actions during conversations — such as searching the web for live information, checking the current time, adding labels to subscribers, or managing follow-up sequence campaigns.

The AI decides when and how to use tools based on conversation context. All tool operations happen silently in the background — the subscriber never sees any tool names, function calls, or technical details. They simply experience a smarter, more capable AI assistant.

Key Features

✅ Tool calling framework — AI autonomously decides when to invoke tools
✅ Web Search — OpenAI built-in real-time web search
✅ Current Time — query date, time, day of week, and timezone
✅ Manage Labels — AI adds or removes subscriber labels based on conversation
✅ Manage Follow-up — AI subscribes or unsubscribes sequence campaigns
✅ Per-tool AI Instruction — customize when and how the AI uses each tool
✅ Whitelist security — AI can only operate on labels and campaigns you explicitly allow
✅ Tool compatibility detection — automatically disables tools incompatible with the selected model
✅ Execution logs — full audit trail of every tool call with parameters, results, and timing
✅ Per-Agent configuration support

Prerequisites

This DLC requires the AI Integration Enhancers base plugin to be installed and enabled. If you have not set up the base plugin yet, follow the parent plugin guide first:

Installation Process

After purchasing the DLC from the NEXTPION marketplace, you can install it using the NEXTPION Plugin Manager.

Install the DLC

Open your NEXTPION Plugin Manager from the main dashboard. Locate the NEXTPION - AI Function Calling DLC in your purchased DLC list and click the Install button. During installation, you will be asked to enter the license key for this DLC.

Installing AI Function Calling DLC

Enable the DLC

After installation is complete, click the Enable button on the DLC card. A modal will open directly on the current page and prompt you to enter the DLC license key. Once the license is verified, you can enable or disable the DLC from this same interface without leaving the page.

Enable AI Function Calling DLC and enter license

User Guide

Once the DLC is installed and enabled, a new Function Calling settings panel automatically appears in the AI configuration page, below the existing settings.

Enabling Function Calling

Open the AI Configuration Page

Navigate to the AI Integration Enhancers configuration page as you normally would (API Channels → OpenAI API).

Locate the Function Calling Section

Scroll down in the left-side settings panel to find the Function Calling section. It displays a toggle switch next to the Function Calling label.

Function Calling toggle switch in configuration panel

Enable Function Calling

Turn on the toggle. The panel will expand to reveal execution settings and the available tools list.

Function Calling expanded settings panel

Execution Settings

After enabling Function Calling, you can configure how the AI executes tool calls.

Execution Settings panel

Max Iterations

Controls how many rounds of tool calling the AI can perform in a single reply. Each round consists of: AI requests tool call → system executes tool → result returned to AI → AI decides whether to continue.

SettingDescription
Options1, 2, 3, 5, 10
Default5
  • Too low may prevent the AI from completing complex tasks that require multiple steps
  • Too high may cause excessive API calls in edge cases

Parallel Calls

When enabled, the AI can request multiple tools simultaneously in a single API response. For example, the AI might call "Get Current Time" and "Web Search" at the same time.

SettingDescription
DefaultEnabled

When disabled, the AI can only call one tool at a time.

Max Tool Calls

Only visible when Parallel Calls is enabled. Controls the maximum number of tools the AI can request in a single API response.

SettingDescription
Options1, 3, 5, 10, 15, 20
Default10

Available Tools

Tools are organized by category. Each tool can be individually enabled or disabled. The tool count badge in the top-right corner shows how many tools are currently enabled.

Available Tools list organized by category

Built-in Tools

An OpenAI native built-in tool (Responses API) — not a custom function. The AI can search the internet in real time to retrieve live information such as news, pricing, weather, and more.

PropertyValue
TypeOpenAI Built-in Tool (web_search)
Requires ConfigNo
Search Context Sizemedium (default)

Compatibility limitations:

  • gpt-4.1-nano does not support Web Search
  • gpt-5 / gpt-5-mini / gpt-5-nano do not support Web Search when reasoning_effort is set to minimal
  • Maximum context window is limited to 128,000 tokens

When a tool is incompatible with the currently selected model, the UI displays an Incompatible badge and automatically disables the tool with a reason message.

Date & Time

Current Time

A custom function tool that returns the current date, time, day of week, timezone, and UTC offset.

PropertyValue
TypeCustom Function
Requires ConfigNo
Parameterstimezone (optional) — e.g. Asia/Shanghai, America/New_York, default UTC

Example response:

{
  "date": "2025-07-18",
  "time": "14:30:00",
  "day_of_week": "Friday",
  "timezone": "Asia/Shanghai",
  "utc_offset": "+08:00"
}

Subscriber Management

Manage Labels

Allows the AI to add or remove labels on the current subscriber based on conversation context. Labels can be used for segmentation, broadcast targeting, and automation flows.

PropertyValue
TypeCustom Function
Requires ConfigYes — must configure an allowed label whitelist
Parametersaction (required: add or remove), label_name (required: must be in whitelist)

Security: The AI can only operate on labels you have explicitly whitelisted. Attempting to use any label outside the whitelist returns an error. Operations are idempotent — adding an existing label or removing a non-existent label succeeds silently.

Manage Follow-up

Allows the AI to subscribe or unsubscribe the current subscriber to/from follow-up sequence campaigns. For example, subscribing when a user shows interest, and unsubscribing after they complete a purchase.

PropertyValue
TypeCustom Function
Requires ConfigYes — must configure an allowed campaign whitelist
Parametersaction (required: subscribe or unsubscribe), campaign_name (required: must be in whitelist)

Security: Same whitelist and idempotency guarantees as Manage Labels.


Tool Configuration

Tools that require configuration (Manage Labels and Manage Follow-up) display a Needs Config badge when enabled. Click the gear icon ⚙️ on the tool row to open the configuration modal.

Configuring Labels

Open the Label Configuration Modal

Click the gear icon ⚙️ next to the Manage Labels tool to open the label configuration modal.

Label Configuration Modal

Step 1: Select a Page

The modal first shows all Facebook and Instagram pages that have Bot enabled. Select the page you want to configure labels for.

Label Configuration Modal

Step 2: Select Labels

After selecting a page, the system loads all labels for that page, showing the label name and subscriber count. Check the labels you want the AI to be able to operate on.

Label Configuration Modal

Apply

Click Apply to save. The selected labels appear as tag chips below the tool in the settings panel.

Label Configuration Modal

Labels must already exist in ChatPion's Subscriber Manager. This modal only selects which existing labels the AI is allowed to use — it does not create new labels.

Configuring Sequence Campaigns

Open the Sequence Configuration Modal

Click the gear icon ⚙️ next to the Manage Follow-up tool to open the sequence configuration modal.

Sequence Configuration Modal

Step 1: Select a Page

Select a Facebook or Instagram page from the list.

Sequence Configuration Modal

Step 2: Select Sequences

The system loads all Messenger sequence campaigns for the selected page and platform. Check the campaigns you want the AI to be able to operate on.

Sequence Configuration Modal

Apply

Click Apply to save. The selected campaigns appear as chips below the tool in the settings panel.

Sequence Configuration Modal

AI Instruction (Per-Tool)

Each enabled tool can have its own AI Instruction that tells the AI when and how to use that specific tool. Click the chat bubble icon 💬 on the tool row to open the AI Instruction editor.

Tool AI Instruction editor modal

Editor Layout

The AI Instruction editor uses a two-column layout:

Left Panel — Tool Reference:

  • Description — what the tool does
  • Parameters — parameter names, types, descriptions, and enum values
  • Labels / Campaigns — configured whitelist items (if applicable)

Enum values (e.g. add, remove) and configured label/campaign names can be clicked to insert into the instruction editor. Inserted values are automatically highlighted:

  • Enum values → blue highlight
  • Labels / campaigns → green highlight

Right Panel — Instruction Editor: A textarea with real-time syntax highlighting for writing tool-specific AI instructions.

Tool AI Instruction editor modal

Example Instructions

Manage Labels:

When a user confirms they have purchased a product, add the "Purchased" label.
When a user asks about premium features or mentions budget over $100, add the "VIP Potential" label.
If a user explicitly asks to stop receiving promotions, add the "No Promo" label.
Do not add labels based on casual browsing — only when clear intent is shown.

Manage Follow-up:

Subscribe the user to "Product Interest Follow-up" when they ask about pricing or features but haven't made a purchase decision yet.
Unsubscribe from "Product Interest Follow-up" when the user confirms a purchase.
Do not subscribe users who are just asking general questions — only when genuine product interest is detected.

Subscriber Context

When Function Calling is enabled, the system automatically injects the current subscriber's context into the AI's system prompt, including:

  • Current Labels — the subscriber's existing label list
  • Active Sequences — the subscriber's currently active sequence campaigns
  • Subscriber Info — basic information (region, gender, subscription date, etc.)

This allows the AI to make smarter decisions — for example, checking whether a label already exists before adding it, or verifying a subscriber is not already in a sequence before subscribing them.


How the AI Uses Tools

The system automatically injects tool usage rules into the AI's system prompt. These rules ensure consistent, invisible, and intelligent tool behavior:

  1. On-demand — The AI decides when to call tools based on conversation context; the user does not need to explicitly request it
  2. No duplicates — Each tool is called at most once per reply to avoid redundant operations
  3. History-aware — If a tool was already used in a previous turn and the state has not changed, the AI will not call it again
  4. Fully transparent — All tool operations are invisible to the subscriber; the AI never mentions tool names, execution details, or results
  5. Natural replies — The AI responds as if everything happened seamlessly, with no indication of background tool activity

Tool Trigger Guidelines

ToolWhen It Triggers
Manage LabelsUser behavior or confirmed status indicates a label change is appropriate
Manage Follow-upUser shows interest but hasn't completed an action (subscribe) or completes an action (unsubscribe)
Current TimeOnly when answering genuinely requires current time and no reliable time info exists in context
Web SearchWhen real-time information is needed to answer the user's question

Working with MCP Server Tools

If MCP Server tools are also enabled, the system instructs the AI to:

  • Use MCP tools for external data retrieval (products, orders, inventory, etc.)
  • Use Function Calling tools for subscriber operations and local assistant functions

Tool Compatibility

The system automatically checks each tool's compatibility with the currently selected AI model.

Compatibility Matrix

ModelWeb SearchCustom Functions
gpt-5✅ (not with reasoning_effort: minimal)✅
gpt-5-mini✅ (not with reasoning_effort: minimal)✅
gpt-5.4-nano✅✅
gpt-5-nano⚠️ Not recommended⚠️ Not recommended
gpt-4.1-nano❌ No Web Search✅

gpt-5-nano is not suitable for Function Calling. This model tends to enter infinite loops when calling tools — repeatedly invoking the same tool, wasting tokens without completing the conversation. Use gpt-5.4-nano (which fixes this issue), gpt-5-mini, or gpt-5 instead.

Compatibility UI Behavior

  • When you switch models, the system re-checks all enabled tools for compatibility
  • Incompatible tools display a red Incompatible badge with a reason message
  • Incompatible tools are automatically disabled and their checkboxes become unclickable
  • Changing reasoning_effort also triggers a compatibility re-check

Testing with AI Playground

After configuring Function Calling, you can immediately test the results in the AI Playground panel on the right side of the configuration page.

AI Playground showing tool call results

Stream Mode — Real-Time Tool Call Tracking

When using Stream Mode, the AI Playground displays the complete tool calling process in real time:

  1. Live tool call panel — When the AI decides to call a tool, a panel opens showing the current tool execution
  2. Running indicator — Active tools display a blue pulse animation and "Running" status
  3. Tool Reasoning — For reasoning models (e.g. gpt-5), expand to see the AI's reasoning for why it chose to call this tool
  4. Execution results and timing — After completion, shows execution time in milliseconds; click to expand full call parameters and response
  5. Web Search results — Web search tool displays search results and citation sources directly in the UI

Tool Call Summary

Each AI message that includes tool calls displays a clickable summary line below the message:

🔧 Used 2 tools  (7ms) >

Click this summary to open the detailed tool call panel showing:

  • Tool name and icon
  • Call parameters (JSON format)
  • Execution result
  • Execution time

This gives you full visibility into the AI's tool usage decisions, making it easy to debug and optimize your AI Instructions.

Use Stream Mode in AI Playground as your primary debugging tool: configure tools and AI Instructions → send test messages → observe tool reasoning and execution in real time → adjust instructions → repeat until the AI behaves as expected.


Live Chat Tool Call Records

During real conversations (not AI Playground), when the AI triggers tool calls while chatting with a subscriber, the system automatically inserts system messages into Live Chat to record the result of each tool call.

Message Format

Each tool call system message follows this format:

✅ Manage Labels: Label "Lead" added successfully
❌ Manage Follow-up: Campaign "Sales Follow-up" not found in allowed list
✅ Current Time: {"date":"2025-07-18","time":"14:30:00","day_of_week":"Friday",...}
  • ✅ — Tool executed successfully
  • ❌ — Tool execution failed or returned an error

Display Rules

  • Messages appear as system messages (sender: system, agent_name: tool_call)
  • Each tool call generates a separate system message
  • Tool names display as readable titles (e.g. "Manage Labels") rather than internal function names
  • Message timestamps use the system-configured timezone
  • Messages are ordered by tool execution sequence, inserted at the relevant position relative to the AI reply

Use Cases

Live Chat tool call records let you:

  • Real-time monitoring — See what operations the AI is performing on subscribers directly in Live Chat
  • Quick troubleshooting — When a subscriber reports an issue, immediately locate whether a tool call failed in the conversation history
  • Team collaboration — Support agents can see what the AI did without needing to check backend logs
  • Audit trail — Every tool call is preserved in the conversation history for later review

These system messages are only visible to backend administrators. Subscribers never see any tool call information in their Messenger conversation.


Per-Agent Configuration

Function Calling supports both global and per-agent settings:

  • Global Configuration — Used when no agent-specific configuration exists
  • Agent Configuration — Each AI Agent (from the AI Agents DLC) can have its own independent Function Calling settings

This means different agents can:

  • Enable different tools
  • Configure different label and campaign whitelists
  • Use different execution parameters
  • Have different AI Instructions for the same tool

When creating a new agent, Function Calling configuration resets to defaults (disabled state) and must be configured separately for each agent.

If you use the AI Agents DLC, each agent's configuration page includes its own Function Calling settings panel. Changes to one agent's settings do not affect other agents or the global configuration.


Data Security

Whitelist Mechanism

The AI can only operate on labels and campaigns you have explicitly configured in the whitelist:

  • Label operations must match a name in the configured labels whitelist
  • Campaign operations must match a name in the configured campaigns whitelist
  • Attempting to operate on items outside the whitelist returns an error and no action is taken

Idempotent Operations

All tool operations are idempotent — repeating the same operation produces no side effects:

  • Adding a label that already exists → success, no change
  • Removing a label that does not exist → success, no change
  • Subscribing to an already-subscribed campaign → success, no change
  • Unsubscribing from a non-subscribed campaign → success, no change

User Data Isolation

  • All configurations are isolated by user_id
  • Tool execution validates subscriber and page ownership
  • Labels and campaigns can only be selected from your own pages

Troubleshooting

Best Practices

  1. Start with simple tools first Enable Current Time and Web Search first to verify the basic tool calling flow works, then add Manage Labels and Manage Follow-up.

  2. Write specific AI Instructions Generic instructions like "use this tool when appropriate" are too vague. Write clear trigger conditions with concrete examples, such as "add the 'Purchased' label when the user confirms they have completed a purchase."

  3. Use the click-to-insert feature When writing AI Instructions, click on parameter enum values and configured label/campaign names in the left reference panel to insert them into the instruction editor. This ensures exact name matching and adds visual highlighting.

  4. Choose the right model Use gpt-5.4-nano for the best balance of cost and reliability. Avoid gpt-5-nano for Function Calling due to loop issues. Use gpt-5-mini or gpt-5 for complex multi-tool scenarios.

  5. Keep whitelists focused Only whitelist the labels and campaigns that the AI genuinely needs to operate on. A smaller, focused whitelist leads to more accurate AI decisions.

  6. Test in Stream Mode Always use Stream Mode in AI Playground when testing Function Calling. This lets you see the AI's reasoning process, tool call parameters, and execution results in real time — essential for debugging.

  7. Monitor execution logs Regularly review tool execution logs to identify patterns — such as frequent errors, unnecessary calls, or unexpected tool usage — and adjust your AI Instructions accordingly.

  8. Use per-agent configuration for different pages If different pages serve different purposes (e.g. support vs. sales), create separate agents with tailored tool configurations — different whitelists, different AI Instructions, even different enabled tools.

AI Function Calling is most powerful when combined with clear AI Instructions and the right model choice. The AI will silently manage labels, sequence campaigns, and information retrieval in the background — making your Messenger bot feel intelligent and responsive without any manual intervention.

Support & Community

Join Our Community

Share your setup, ask questions, and learn advanced usage tips for AI Function Calling from other NEXTPION users.

View