AI bot api parameter to select the "personas" to be "Forum Helper" when sending message?

AI-generated summary

The discussion is about selecting the “Forum Helper” persona when sending a message to the Discourse AI bot via API. xFocus is trying to achieve this, but the bot is defaulting to searching the forum instead. The key parameter to indicate the persona is likely missing, with sam suggesting that the issue lies with "meta_data[ai_persona_id]": "-1". xFocus confirms this by checking the data explorer and finding that the value determines which persona to interact with. The goal is to identify the correct API parameter to select the “Forum Helper” persona.

hi all, a question on send requests to discourse-ai bot

if I create a message to ai-bot, I can select the “personas” to be “Forum Helper”

and forum helper will respond to my message, as below

so I want to do the same thing via api post call, here is the payload in my script which I just copied from the reverse engineering suggestion

    url = f"{DISCOURSE_BASE_URL}/posts"
    payload = {
        "title": subject,
        "raw": message,
        "target_recipients": DISCOURSE_BOT_USERNAME,
        "archetype": "private_message",
        "unlist_topic": "false",
        "category": "",
        "is_warning": "false",
        "typing_duration_msecs": "2600",
        "composer_open_duration_msecs": "53220",
        "featured_link": "",
        "shared_draft": "false",
        "draft_key": "private_message_ai",
        "meta_data[ai_persona_id]": "-1",
        "nested_post": "true"
    }
    response = requests.post(url, headers=HEADERS, json=payload)

but what I got is a bot trying to search my forum instead of the “Forum Helper”, from below you can see that there is no such “Forum Helper” tag at the right of the gemni user, as below

I tried to go to /admin/plugins/discourse-ai/ai-personas and only leave “Forum Helper” checked and all rest un-checked, but not helping.

I guess I’m missing some key parameter to indicate I want to message “Forum Helper” of ai bot, not the default one which seems to be searching inside of my forum content?

Thank you! :slight_smile:

This is indeed the key piece of information.

My guess here is that somehow it is not being set, can you look at it in data explorer?

select * from topic_custom_fields where id=XYZ

yes you are definitely right

I pulled out from the data explorer and the value is for which persona to interact with, thank you Sam :+1: