Skip to content

Instantly share code, notes, and snippets.

View MyWay's full-sized avatar

MyWay MyWay

  • Self-employed
  • Rome
View GitHub Profile
@MyWay
MyWay / matrix.ts
Created May 3, 2023 21:06
Activepiece Send Matrix Message using Room Alias instead of Room Internal ID
// matrix/src/lib/common/common.ts
import { httpClient, HttpMethod, AuthenticationType, HttpResponse } from "@activepieces/pieces-common";
export async function getRoomId(baseUrl: string, roomAlias: string, accessToken: string): Promise<HttpResponse> {
const response = httpClient.sendRequest({
method: HttpMethod.GET,
url: `${baseUrl}/_matrix/client/r0/directory/room/${encodeURIComponent(roomAlias)}`,
authentication: {
type: AuthenticationType.BEARER_TOKEN,