# Twilio SMS to RocketChat #channel Results in Blank Message

**URL:** <https://forums.rocket.chat/t/twilio-sms-to-rocketchat-channel-results-in-blank-message/2746>\
**Category:** Community Support\
**Created:** [December 19, 2018, 8:15pm UTC](https://forums.rocket.chat/t/twilio-sms-to-rocketchat-channel-results-in-blank-message/2746 "2018-12-19T20:15:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allison](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/allison/32/1021_2.png) [@Allison](https://forums.rocket.chat/u/Allison)\
**Post date:** [December 19, 2018, 8:15pm UTC](https://forums.rocket.chat/t/twilio-sms-to-rocketchat-channel-results-in-blank-message/2746/1 "2018-12-19T20:15:00Z")

</div>

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.)

> **[Post Messages to Slack with Twilio Studio](https://www.twilio.com/docs/studio/tutorials/how-to-post-sms-to-slack)**
>
> Post inbound SMS to a Slack feed with Twilio Studio and an incoming Slack webhook.

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.

 ![twilio-sms-rocket-chat-blank](https://us1.discourse-cdn.com/flex021/uploads/rocketchat/original/1X/be51d73765a7abd00fffda67808ea9fe14abd55e.png)

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

Any assistance shall be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![Allison](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/allison/32/1021_2.png) [@Allison](https://forums.rocket.chat/u/Allison)\
**Post date:** [December 19, 2018, 8:16pm UTC](https://forums.rocket.chat/t/twilio-sms-to-rocketchat-channel-results-in-blank-message/2746/2 "2018-12-19T20:16:29Z")

</div>

Visual reference for Twilio Studio HTTP Parameters  
 ![twilio-studio-http-param](https://us1.discourse-cdn.com/flex021/uploads/rocketchat/original/1X/98986a6beeeb777848fc763c265ae6be10bfe1c9.jpeg)

---

<div class="post-metadata">

**Author:** ![marcelo.schmidt](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/marcelo.schmidt/32/20_2.png) [@marcelo.schmidt](https://forums.rocket.chat/u/marcelo.schmidt)\
**Post date:** [December 20, 2018, 12:21pm UTC](https://forums.rocket.chat/t/twilio-sms-to-rocketchat-channel-results-in-blank-message/2746/3 "2018-12-20T12:21:08Z")

</div>

Here’s how I’ve done this:

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

```auto
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:

 ![image](https://us1.discourse-cdn.com/flex021/uploads/rocketchat/original/1X/ada409fc2490bbab45a0804b904b489da60f2e95.png)

---

<div class="post-metadata">

**Author:** ![Allison](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/allison/32/1021_2.png) [@Allison](https://forums.rocket.chat/u/Allison)\
**Post date:** [December 20, 2018, 12:46pm UTC](https://forums.rocket.chat/t/twilio-sms-to-rocketchat-channel-results-in-blank-message/2746/4 "2018-12-20T12:46:17Z")

</div>

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/](https://chat.bubbatrading.com/)…”

and wallah. Super awesome.

Thank you.

---

<div class="post-metadata">

**Author:** ![bbrendon](https://avatars.discourse-cdn.com/v4/letter/b/3e96dc/32.png) [@bbrendon](https://forums.rocket.chat/u/bbrendon)\
**Post date:** [December 20, 2018, 10:38pm UTC](https://forums.rocket.chat/t/twilio-sms-to-rocketchat-channel-results-in-blank-message/2746/5 "2018-12-20T22:38:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bbrendon](https://avatars.discourse-cdn.com/v4/letter/b/3e96dc/32.png) [@bbrendon](https://forums.rocket.chat/u/bbrendon)\
**Post date:** [December 21, 2018, 1:05am UTC](https://forums.rocket.chat/t/twilio-sms-to-rocketchat-channel-results-in-blank-message/2746/6 "2018-12-21T01:05:25Z")

</div>

nm. I figured out data.From

---

<div class="post-metadata">

**Author:** ![stevenvu](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/stevenvu/32/1545_2.png) [@stevenvu](https://forums.rocket.chat/u/stevenvu)\
**Post date:** [March 3, 2020, 9:37pm UTC](https://forums.rocket.chat/t/twilio-sms-to-rocketchat-channel-results-in-blank-message/2746/7 "2020-03-03T21:37:13Z")

</div>

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)](https://www.twilio.com/docs/sms/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.

> **[SMS Webhooks](https://www.twilio.com/docs/usage/webhooks/sms-webhooks)**
>
> Learn how to use webhooks to process events in your Twilio Programmable SMS application. You can use Twilio webhooks to handle incoming messages as well as tracking delivery status on outbound messages.

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.
