@pipedream/microsoft_teams 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,9 +3,9 @@ import microsoftTeams from "../../microsoft_teams.app.mjs";
3
3
  export default {
4
4
  key: "microsoft_teams-send-chat-message",
5
5
  name: "Send Chat Message",
6
- description: "Send a message to a team's chat. [See the docs here](https://docs.microsoft.com/en-us/graph/api/chat-post-messages?view=graph-rest-1.0&tabs=http)",
6
+ description: "Send a message to a team's chat. Optionally include inline images via `hostedContents`. [See the docs here](https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http)",
7
7
  type: "action",
8
- version: "0.0.12",
8
+ version: "0.0.13",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -31,23 +31,41 @@ export default {
31
31
  "contentType",
32
32
  ],
33
33
  },
34
+ hostedContents: {
35
+ type: "string[]",
36
+ label: "Hosted Contents",
37
+ description: "An array of JSON strings, each representing an inline hosted image to attach. Each item must be a JSON object with `'@microsoft.graph.temporaryId'` (string), `contentBytes` (base64-encoded image data), and `contentType` (MIME type, e.g. `image/png`). Example: `{\"@microsoft.graph.temporaryId\": \"1\", \"contentBytes\": \"BASE64_STRING\", \"contentType\": \"image/png\"}`. Reference each image in your HTML message body using `<img src=\"../hostedContents/1/$value\">`. [See the docs](https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http#example-6-send-inline-images-along-with-the-message)",
38
+ optional: true,
39
+ },
34
40
  },
35
41
  async run({ $ }) {
36
42
  const {
37
43
  chatId,
38
44
  message,
39
45
  contentType,
46
+ hostedContents,
40
47
  } = this;
41
48
 
49
+ const parsedHostedContents = hostedContents?.map((item) =>
50
+ typeof item === "string"
51
+ ? JSON.parse(item)
52
+ : item);
53
+
54
+ const content = {
55
+ body: {
56
+ content: message,
57
+ contentType: contentType ?? "text",
58
+ },
59
+ };
60
+
61
+ if (parsedHostedContents?.length) {
62
+ content.hostedContents = parsedHostedContents;
63
+ }
64
+
42
65
  const response =
43
66
  await this.microsoftTeams.sendChatMessage({
44
67
  chatId,
45
- content: {
46
- body: {
47
- content: message,
48
- contentType,
49
- },
50
- },
68
+ content,
51
69
  });
52
70
 
53
71
  $.export("$summary", `Successfully sent message to chat ${chatId}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/microsoft_teams",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Pipedream Microsoft Teams Components",
5
5
  "main": "microsoft_teams.app.mjs",
6
6
  "keywords": [