Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACTION] Microsoft Teams Bot - Reply to Message #14758

Open
malexanderlim opened this issue Nov 27, 2024 · 10 comments · May be fixed by #14817
Open

[ACTION] Microsoft Teams Bot - Reply to Message #14758

malexanderlim opened this issue Nov 27, 2024 · 10 comments · May be fixed by #14817
Assignees
Labels
action New Action Request enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed triaged For maintainers: This issue has been triaged by a Pipedream employee

Comments

@malexanderlim
Copy link
Collaborator

malexanderlim commented Nov 27, 2024

Is there a specific app this action is for?
Microsoft Teams Bot

Example workflow for testing:
https://pipedream.com/@pd-component-dev/projects/proj_mJs6Ybr/ms-teams-bot-p_WxCWqBN/build

API Documentation:
https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-quickstart?view=azure-bot-service-4.0#reply-to-the-users-message

Example working code:

import { axios } from "@pipedream/platform"

export default {
  props: {
    microsoft_teams_bot: {
      type: "app",
      app: "microsoft_teams_bot",
    }
  },
  async run({steps, $}) {
    // Get the incoming message data
    const incomingMessage = steps.trigger.event.body;
    
    const data = {
      type: "message",
      from: {
        id: incomingMessage.recipient.id,
        name: incomingMessage.recipient.name
      },
      conversation: {
        id: incomingMessage.conversation.id
      },
      recipient: {
        id: incomingMessage.from.id,
        name: incomingMessage.from.name
      },
      text: "Hello! I received your message: " + incomingMessage.text,
      replyToId: incomingMessage.id
    };

    return await axios($, {
      url: `${incomingMessage.serviceUrl}/v3/conversations/${incomingMessage.conversation.id}/activities/${incomingMessage.id}`,
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${this.microsoft_teams_bot.$auth.oauth_access_token}`,
        'Content-Type': 'application/json'
      },
      data,
    });
  },
}
@malexanderlim malexanderlim added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers action New Action Request labels Nov 27, 2024
@jcortes jcortes self-assigned this Dec 2, 2024
@jcortes jcortes moved this from Prioritized to Doing in Component (Source and Action) Backlog Dec 2, 2024
@vunguyenhung vunguyenhung added the triaged For maintainers: This issue has been triaged by a Pipedream employee label Dec 3, 2024
@jcortes jcortes linked a pull request Dec 3, 2024 that will close this issue
@jcortes jcortes moved this from Doing to Ready for PR Review in Component (Source and Action) Backlog Dec 5, 2024
@michelle0927 michelle0927 moved this from Ready for PR Review to Ready for QA in Component (Source and Action) Backlog Dec 5, 2024
@vunguyenhung vunguyenhung moved this from Ready for QA to In QA in Component (Source and Action) Backlog Dec 6, 2024
@vunguyenhung
Copy link
Collaborator

vunguyenhung commented Dec 6, 2024

Hi @sergio-eliot-rodriguez @malexanderlim, @jcortes

I faced the 403 error when testing the action, here's my taken steps

  1. I tried to setup a new bot on my side. During my test, I figured out that the Type of App needs to be Multi Tenant in other for Pipedream OAuth to connect
    image

After creating the bot, I need to set the bot's Messaging endpoint to a Pipedream HTTP endpoint
image

Then I need to create a new secret on the bot Azure App Registration
image

Copy the Azure Application ID and new Client Secret to Pipedream, I see the connect success message
image
Screenshot 2024-12-06 at 17 25 04

Then on my Azure Bot, I send a test message on Test Web Chat
image

Resulted in a new event on the Pipedream HTTP source
image

Use the fields in this source for the action, it failed with 403 code. Could you help checking this to identify if this is on my side or action side?
image

On another note, I think we need to have a step-by-step guide on how to setup Microsoft Teams Bot (similar to what I have done above).

@vunguyenhung vunguyenhung moved this from In QA to Changes Required in Component (Source and Action) Backlog Dec 6, 2024
@vunguyenhung
Copy link
Collaborator

Hello everyone, I have tested this PR and there're some test cases failed or needed improvement.

Please check the test report below for more information
https://vunguyenhung.notion.site/ACTION-Microsoft-Teams-Bot-Reply-to-Message-153bf548bb5e810aa2e8e48eaa11bd57

@jcortes
Copy link
Collaborator

jcortes commented Dec 10, 2024

Hi @malexanderlim I'm not familiar with the Bot setup can you give me a hand on this one please. Seems like there is some auth issue in the bot setup or something.

@jcortes jcortes moved this from Changes Required to Blocked in Component (Source and Action) Backlog Dec 10, 2024
@malexanderlim malexanderlim moved this from Blocked to Ready for QA in Component (Source and Action) Backlog Dec 11, 2024
@malexanderlim
Copy link
Collaborator Author

@vunguyenhung you can take a look at the README I put together here:
https://github.com/PipedreamHQ/pipedream/pull/14932/files

There's a bug currently which is not publishing the README to the marketplace that we're in the process of resolving here:
#14930

@vunguyenhung vunguyenhung moved this from Ready for QA to In QA in Component (Source and Action) Backlog Dec 12, 2024
@vunguyenhung vunguyenhung moved this from In QA to Changes Required in Component (Source and Action) Backlog Dec 13, 2024
@vunguyenhung
Copy link
Collaborator

Hello everyone, I have tested this PR and there're some test cases failed or needed improvement.

Please check the test report below for more information
https://vunguyenhung.notion.site/ACTION-Microsoft-Teams-Bot-Reply-to-Message-153bf548bb5e810aa2e8e48eaa11bd57

@jcortes
Copy link
Collaborator

jcortes commented Dec 13, 2024

Hi @vunguyenhung I didn't quite get what you meant in the QA report
cc: @malexanderlim

@vunguyenhung
Copy link
Collaborator

Hi @jcortes
The reply should be like this
image

Which is created by clicking the Reply button next to the message
image

I expect the Reply to Message action would produce the same reply.

@jcortes
Copy link
Collaborator

jcortes commented Dec 13, 2024

Hi @vunguyenhung I'm afraid the use case is for the Bot to reply and not the User, howerver @malexanderlim correct me if I'm wrong on this according to our tests we made previously.

@vunguyenhung
Copy link
Collaborator

HI @jcortes, if the bot is not able to reply to a specific message, then we can remove the Reply to Message action. From my point of view, the Send Message action is producing the same behavior as the Reply to Message right now

@jcortes
Copy link
Collaborator

jcortes commented Dec 16, 2024

There is a difference but it is not so obvious as you potined out.

  1. The Send Message action basically doesn't have the Reply To ID prop which is used to iteract with the Bot itself. So this is just a direct message to the Bot.
  2. The Reply To Message on the other hand is used to interact with the Bot message so you have to set the Reply To ID which has to be the id of the body from the trigger

Those are the Use Cases I understood from @malexanderlim and from what I've read

@jcortes jcortes moved this from Changes Required to Blocked in Component (Source and Action) Backlog Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action New Action Request enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed triaged For maintainers: This issue has been triaged by a Pipedream employee
Development

Successfully merging a pull request may close this issue.

3 participants