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

[JS] feat: add helper functions to to get Teams channels, members, and details #1949

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

yiqing-zhao
Copy link
Contributor

@yiqing-zhao yiqing-zhao commented Aug 26, 2024

Linked issues

closes: #minor

Details

Provide a list of your changes here. If you are fixing a bug, please provide steps to reproduce the bug.

Change details

We have encapsulated three APIs from TeamsInfo class of botbuilder library: getTeamChannels, getTeamDetails, and getPagedMember, to facilitate easier proactive message sending. These three APIs have been wrapped as an initial sample. If this approach is deemed acceptable, we intend to extend this encapsulation to include additional APIs provided by TeamsInfo, such as sendMessageToListOfUsers, sendMessageToAllUsersInTenant, and more.

PM Contact: @MuyangAmigo

code snippets:
To use the APIs:

for (const reference of conversationReferences) {
  await app.sendProactiveActivity(
    reference,
    "Proactive message from RestifyNotiBot!"
  );

  if (reference.conversation?.conversationType === "channel") {
    const details = await app.getTeamDetails(reference);
    const teamMembers = await app.getPagedMembers(reference);
    console.log(details, teamMembers.members.length);
  }
}

screenshots:
Results are printed as belows, furthur
image

Attestation Checklist

  • My code follows the style guidelines of this project

  • I have checked for/fixed spelling, linting, and other errors

  • I have commented my code for clarity

  • I have made corresponding changes to the documentation (updating the doc strings in the code is sufficient)

  • My changes generate no new warnings

  • I have added tests that validates my changes, and provides sufficient test coverage. I have tested with:

    • Local testing
    • E2E testing in Teams
  • New and existing unit tests pass locally with my changes

Additional information

Feel free to add other relevant information below

@corinagum
Copy link
Collaborator

could you also add unit tests for the new code? thanks!

@yiqing-zhao
Copy link
Contributor Author

could you also add unit tests for the new code? thanks!

Thanks @corinagum, some unit tests are added for the codes. Please help to review, thanks!

@corinagum
Copy link
Collaborator

@yiqing-zhao Thank you! Internally we are discussing some structural strategies that would affect these changes so this PR may not be merged immediately until we finalize on those decisions. We might need to iterate on your changes before merge as well, but we appreciate the contribution! I'll update this thread as more information becomes available.

@MuyangAmigo
Copy link
Member

@yiqing-zhao Thank you! Internally we are discussing some structural strategies that would affect these changes so this PR may not be merged immediately until we finalize on those decisions. We might need to iterate on your changes before merge as well, but we appreciate the contribution! I'll update this thread as more information becomes available.

Hey @corinagum have those discussions been finalized?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants