Twilio SMS to RocketChat #channel Results in Blank Message

Hello, i am attempting to create a webhook that will post an SMS message received via a Twilio number to a specific channel on our rocketchat server , based on this Twilio/Slack tutorial (was hoping the underlying tech between Slack/RocketChat would be similar enough.)

However, I am completely stuck as the message seems to arrive into the specific room (posted by SMS Admin, alias for Rocket.Cat) but the body of the message is blank.

As such, I am guessing the http parameters are incorrect:
payload:
{“text”: “{{trigger.message.Body}}”}

Any assistance shall be greatly appreciated.

Visual reference for Twilio Studio HTTP Parameters
twilio-studio-http-param

Here’s how I’ve done this:

Configured an Incoming Webhook on Rocket.Chat with the following script:

class Script {

	/**
	 * @params {object} request
	 */
	process_incoming_request({ request }) {
		const data = request.content;
        const msg = {
          content: {
            attachments: []
          }
        };

		msg.content.text = data.Body;
        return msg;
	}
}

Then copied the Webhook URL and pasted it in the Messaging Webhook, in Twilio:

Woo woo, thank you thank you.

At first I just added the script you provided and same result… then I noticed you were not using studio for your number…so I switched from “A MESSAGE COMES IN = Studio Flow/Twilio-Test” (duh)

To your example of “A MESSAGE COMES IN=Webhook https://chat.bubbatrading.com/…”

and wallah. Super awesome.

Thank you.

Really cool… how could I get the phone number in the message of the sms sender in the rocket.chat message?

nm. I figured out data.From

The script works, however, I get an error in Twilio:

Msg “Invalid Content-Type: application/json supplied”
sourceComponent “14100”
ErrorCode “12300”
EmailNotification “false”
contentType “application/json”
LogLevel “ERROR”

I think the problem stems from Twilio expecting a response:

<Response></Response>

Your application will need to return Twilio Markup Language (TwiML) as the response to Twilio’s webhook request. This response will tell Twilio what to do - for instance, replying to the inbound text message with your own message that more information from the sender.

Can anyone help me with changing the script so that it responds with:

<Response></Response>

I’d imagine it’s quite easy, however, have no clue how to modify the script.