Discourse need to send private message to a specific user

Sometimes, I want to send private message to a user. Could you consider this option in target_recipients parameters?

{
  "title": "string",
  "raw": "string",
  "topic_id": 0,
  "category": 0,
  "target_recipients": "blake,sam",
  "target_usernames": "string",
  "archetype": "private_message",
  "created_at": "string",
  "embed_url": "string"
}

https://docs.discourse.org/#operation/createTopicPostPM

Here’s an HTTP node that will let you send a Discourse DM: (but +1 to adding this option to the Discourse node)

{
  "nodes": [
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "https://SITE/posts.json",
        "options": {},
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "title",
              "value": "MESSAGE SUBJECT"
            },
            {
              "name": "target_usernames",
              "value": "USERNAMES"
            },
            {
              "name": "archetype",
              "value": "private_message"
            },
            {
              "name": "raw",
              "value": "MESSAGE"
            }
          ]
        },
        "headerParametersUi": {
          "parameter": [
            {
              "name": "Api-Key",
              "value": "YOUR API KEY"
            },
            {
              "name": "Api-Username",
              "value": "YOUR API USERNAME"
            }
          ]
        }
      },
      "name": "Send DM",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1120,
        720
      ]
    }
  ],
  "connections": {}
}
1 Like

I want to update a private message. But it seems discourse api do not have.
Could I update private message with a PUT topic?

Anything you can do in Discourse, you can do through the API. You can use the network inspector to see the network traffic and recontruct the required API call from that.

1 Like

I tried that, but it seems blank here

Hmm, I definitely see an API request - you may not be doing something right here. Anyway, this seems a question that’s more suitable for meta.discourse.org?

image

image

1 Like

Hi, I need your help here:

When I tried to update private message, it has different 2 IDs:

  1. ID of private message
  2. ID with bigger number (like a ID for edit private message)

When I test to send PUT request, ID of private message just can change title. And can not change message details by “raw”

It seems message details must change by new edit ID

Do you know this issue?

This really is a question for meta.discourse.org - I see you already started a topic there too…

1 Like