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

add new param space id for bot.js #57

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ Bot.prototype.dm = function (person, format, message) {
* @function
* @param {Object} cardJson - The card JSON to render. This can come from the Webex Buttons and Cards Designer.
* @param {String} fallbackText - Message to be displayed on client's that can't render cards.
* @param {String} [spaceId] - The alternative space id
* @returns {Promise.<Message>}
*
* @see {@link https://developer.webex.com/docs/api/guides/cards#working-with-cards|Buttons and Cards Guide} for further information.
Expand Down Expand Up @@ -1255,7 +1256,7 @@ Bot.prototype.dm = function (person, format, message) {
* });
*
*/
Bot.prototype.sendCard = function (cardJson, fallbackText) {
Bot.prototype.sendCard = function (cardJson, fallbackText, spaceId) {
if (!this.active) {
let msg = 'bot.sendCard() failed, bot is not in active state';
if ((this.framework) && ("membershipRules" in this.framework)) {
Expand All @@ -1267,7 +1268,7 @@ Bot.prototype.sendCard = function (cardJson, fallbackText) {
let messageObj = buildCardMsgObj(cardJson,
this.framework.messageFormat, fallbackText);
// send constructed message object to room
messageObj.roomId = this.room.id;
messageObj.roomId = spaceId ? spaceId : this.room.id;
return this.framework.webex.messages.create(messageObj);
};

Expand Down