WebHook from Rocket to Microsoft Teams is not working

Description

Im trying to create webhook between Rocket.chat and MS teams and did all from this guide:

Unfortunately, hook works only in one direction: from Rocket.chat to MS Teams , vice versa is not

Once im testing webhook which located in Incoming Integration by curl command - i’m receiving following:

curl -X POST -H ‘Content-Type: application/json’ --data ‘{“text”:“Example message”,“attachments”:[{“title”:“Rocket.Chat”,“title_link”:“rocket.chat”,“text”:“Rocket.Chat, the best open source chat”,“image_url”:"/images/integration-attachment-example.png",“color”:"#764FA5"}]}’ my.site.com/hooks/XXXxxXXXXxx
{“success”:false,“error”:“error-running-script”}

From server log i see below:

Oct 12 07:57:49 rocketchat RocketChat[479]: server.js:204 Integrations ➔ Incoming WebHook.error [Error running Script in Trigger Teams - Rocket.chat :]
Oct 12 07:57:49 rocketchat RocketChat[479]: server.js:204 Integrations ➔ Incoming WebHook.error var Script=function(){function Script(){}var _proto=Script.prototype;_proto.process_incoming_request=function process_incoming_request(_ref){var request=_ref.request;if(“edited_message"in request.content){request.content=request.content}var from=request.content.from;var icon_url=”/avatar/"+from.name+".jpg";var body=request.content.text.slice(16);if(!body){if(request.content.hasOwnProperty(“sticker”)&&request.content.sticker.emoji){body=request.content.sticker.emoji}else{return{}}}return{content:{icon_url:icon_url,text:body}}};return Script}();
Oct 12 07:57:49 rocketchat RocketChat[479]: server.js:204 Integrations ➔ Incoming WebHook.error [Stack:]
Oct 12 07:57:49 rocketchat RocketChat[479]: server.js:204 Integrations ➔ Incoming WebHook.error Error: TypeError: Cannot read property ‘name’ of undefined
Oct 12 07:57:49 rocketchat RocketChat[479]: at Promise.catch (evalmachine.:11:33)
Oct 12 07:57:49 rocketchat RocketChat[479]: at /var/lib/rocket.chat/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40

I understood that the issue in from.name function in this section :
let who = from.name;
let icon_url = ‘/avatar/’ + from.name + ‘.jpg’

but don’t know how to change it to correct one.

P.S. I tried to switch “from.name” to “request.name” and “request.user_name” and CURL command returned success - but no messages received to chanel where hook is configured on Rocket.chat side

Could someone help me in this? Maybe you faced with such issue in the past

Server Setup Information

  • Version of Rocket.Chat Server: 2.4.11
  • Operating System: Ubuntu 18.04
  • Deployment Method: tar
  • NodeJS Version: nodejs --version v8.10.0
  • MongoDB Version: MongoDB shell version v4.2.9
  • Proxy: nginx/1.16