Twilio SMS to RocketChat #channel Results in Blank Message


#1

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.


#2

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


#3

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:


#4

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.


#5

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


#6

nm. I figured out data.From