创建预填个人消息链接

:bookmark: 本指南介绍如何创建链接以启动带有预填充信息的新的私信,包括最佳实践。

:person_raising_hand: 所需用户级别:所有用户

Discourse 允许您通过 URL 参数撰写带有预填充信息的新私信。这可以节省时间并确保常见消息的一致性。

URL 的结构

要创建新的预填充消息,请按如下格式设置您的 URL:

https://discourse.example.com/new-message?username=techapj&title=message%20title&body=message%20body

分解后,URL 参数包括:

  • 基础 URLhttps://discourse.example.com/new-message
  • 用户名username=techapj
  • 标题title=message%20title
  • 正文body=message%20body
  • ? URL 运算符,用于添加不同的选项

您可以在 try.discourse.org 上尝试此操作:

https://try.discourse.org/new-message?username=rudy&title=message%20title&body=message%20body

您也可以通过 URL 为群组撰写预填充消息:

https://meta.discourse.org/new-message?groupname=team&title=topic%20title&body=topic%20body

注意上面 URL 中的 groupname 参数,这意味着您想为群组创建新的预填充消息(与用于为用户撰写消息的 username 相对应)。您也可以使用 group_name 作为 groupname 的替代项。

标签

您可以通过添加 tags 参数来预填充私信中的标签:

https://discourse.example.com/new-message?username=techapj&title=Bug%20Report&body=Details&tags=tag1,tag2

:exclamation: 这要求 pm_tags_allowed_for_groups 站点设置包含用户所属的群组。如果未为用户启用 PM 标记,则 tags 参数将被静默忽略。

最佳实践

  • 您可以通过逗号分隔用户名来向多个用户发送消息。例如:

    https://meta.discourse.org/new-message?username=foo,bar
    
  • 您不需要填写所有参数。例如,以下任何一个都有效:

    https://meta.discourse.org/new-message
    https://meta.discourse.org/new-message?username=
    https://meta.discourse.org/new-message?title=foo&body=bar
    https://meta.discourse.org/new-message?groupname=
    
  • 您可以使用 %0A%0A%0D 代码添加换行符,为消息正文提供一些结构:

    https://yoursite.discourse.org/new-message?username=test_user&title=Bug%20Report&body=Please%20include%20all%20relevant%20details.%0A%0DCPU:%0AMemory:%0A%0DDescribe%20Issue:
    
  • 如果您有 DiscourseConnect (SSO),您可以链接到 example.com/session/sso,然后设置 return_path 以创建私信。如果用户已登录,他们将自动重定向到 return_path 提供的 URL。如果他们未登录,他们将被带到 DiscourseConnect 登录页面,然后重定向到 return_path URL。return_path 需要进行 URL 编码。

    href="http://localhost:3000/session/sso?return_path=http%3A%2F%2Flocalhost%3A3000%2Fnew-message%3Fusername%3Dscossar%26title%3DInformation+requested+about+gentle+yoga+classes">
    

当前不支持的功能

  • 使用预填充 URL 向多个群组撰写消息。
  • 使用预填充 URL 在用户摘要页面上打开撰写器。
  • 使用电子邮件而不是用户名来预填充私信。

附加资源

56 个赞
Starting creating a new private message via link?
(Mailing List) Link to private message
Link to private message a user from outside via URL
Private message composition URLs don't work with SSO
Move '+ New' Button to Top of Custom Group Page
Feedback form / reporting bugs
How can I compose a link that sends me a PM?
Allow sending Private Messages to Staff
Is there a way to create a link to create a new private message to a specific user with preformed subject and body?
Possible to compose pre-filled MULTI user private message via URL?
Possible to compose pre-filled MULTI user private message via URL?
Always allow PM to admin/moderators?
Form template for Personal messages
Create a link that will open the editor with a specific category and a specific tag
Running a photo competition
Help With a Private Topics/Replies Alternative?
Link for new DM / personal chat message with pre-filled information
Sidebar link / top button to PM admin
Prefilled composer link generator
Wizards that send upon submitting a PM to a group or a person
Create a link to start a new personal message without redirect
Could Persona Editor for Discourse become an analogue of GPT Builder based on Discourse in the future?
Quick link to go to personal chat
Placeholder Forms
Discourse Private Replies
Discourse Private Replies
Spoiler but only admins can see it
Dark/Light Mode Toggle
Link to start a chat with someone
Is it possible to @mention a user in the banner as a quick access to provide mod/admin support?
Allow multiple ‘new topic’ drafts
Allow multiple ‘new topic’ drafts
Private Message Button in Posts or "Post Menu" area
Creating a link to start a new topic with pre-filled information
Creating personal message to self for taking notes, without filling own username by hand
Creating personal message to self for taking notes, without filling own username by hand
Is there a way to have a link that will PM all staff?
Open composer for existing topic/personal message via URL
Allow TL0 to write messages to staff group, not to other members or non staff?
How to go about hosting a design contest?
Rename @discobot's start new user command
Fire SSO Login to discourse onLogIn on external site
Weekly exercise topics with hidden replies
Req: new message icon from avatar menu
Directing users to send a PM
Staff Application
Discourse API Get Current Topic
Onboarding: Discobot, automated messages, other options?