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

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:

1 Like

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

1 Like

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:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.