NodeSDK inviteUserIncompany API fails
RéponduHi,
When I execute the following function, an err from Rainbow is catched (see below). The output of the debug in this function is:
-- SDK Invite2RB: rbuser2@*masked*.com You have been invited for the dirkDemo event by an email sent on Aug 12th 2018. Please install the Rainbow app and register with your business email address. You will soon recveive a Rainbow message of Annie, your Event Companion, with more information. 570e0cd681b58af7dc3d3b25 --
So all parameters given to 'inviteUserInCompany' seem valid. Could this be an admin issue, since the bot is in the ALE domain?
Bot email is alebot1@*masked*.com, SDK is release 1.44.0
Function:
inviteToRainbow(email, txt) {
return new Promise((resolve, reject) => {
debug("SDK Invite2RB:",email,txt,this._me.companyId);
this._sdk.admin.inviteUserInCompany(email, this._me.companyId, "en-US", txt)
.then(result => {
resolve(result)
})
.catch(err => {
reject(err)
})
})
}
Error:
RB invite failed: TypeError: Cannot convert undefined or null to object
at Function.assign (<anonymous>)
at /root/nodejs/didatabelgium/node_modules/rainbow-node-sdk/lib/connection/RESTService.js:1034:31
at new Promise (<anonymous>)
at RESTService.inviteUser (/root/nodejs/didatabelgium/node_modules/rainbow-node-sdk/lib/connection/RESTService.js:1027:16)
at /root/nodejs/didatabelgium/node_modules/rainbow-node-sdk/lib/services/Admin.js:379:28
at new Promise (<anonymous>)
at Admin.inviteUserInCompany (/root/nodejs/didatabelgium/node_modules/rainbow-node-sdk/lib/services/Admin.js:360:16)
at Promise (/root/nodejs/didatabelgium/src/ale-rainbow.ts:414:29)
at new Promise (<anonymous>)
at Bot.inviteToRainbow (/root/nodejs/didatabelgium/src/ale-rainbow.ts:412:16)
at sendRBinvite (/root/nodejs/didatabelgium/src/index.ts:1045:17)
-
Hello,
Yes, some logs are missing to give you a definite answer, but you probably had the following message before the error :
error: REST - (inviteUser) Admin API requested has no Admin roles
This means that the user you used to loggin (alebot1@*masked*.com i believe) has not right to invite someone. You have to use an other one, or to change his rights.
The error is a bug when preparing the message to tell you that the user has not admin rights. I will correct it for next release (1.45.1)
Best regards,
Vincent.
Vous devez vous connecter pour laisser un commentaire.
Commentaires
3 commentaires