View as Markdown
Element icon

Element ACTION

Send Message

Send a text message to a room. The room must be one the connected account has already joined, and must be identified by room ID rather than alias — use List Rooms to find it. Returns the event_id of the sent message. See the documentation
  • Action
  • Writes data
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Element account once, then configure and run Send Message from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "element-send-message",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    element: { authProvisionId: "apn_xxxxxxx" },
    roomId: "Room ID",
    body: "Message",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Send Message inputs
Property Type Description
roomId Room ID string
The Matrix room ID, e.g. !OGEhHVWSdvArJzumhm:matrix.org. Use List Rooms to find the ID of a room you've already joined, or Resolve Room Alias to convert an alias such as #engineering:matrix.org into an ID. Aliases are not accepted here.
Required
body Message string
The text of the message to send, e.g. Hello from Pipedream!
Required
msgtype Message Type string
The type of message to send. Defaults to m.text. m.notice marks the message as coming from an automated client — clients display it distinctly and never auto-respond to it, which prevents bot-to-bot reply loops. m.emote sends it as an action, e.g. displayed as "* Alice waves".
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
element-send-message
Version
0.0.2
App
Element
Authentication
API key
Read-only
No
Destructive
No
Open world
Yes