0
Solved

HTTP GET variables cannot handle line breaks

I'm trying to forward my SMS, and %SMSRB has line breaks, but when sending using `HTTP GET request`, I only get its first line.

The line breaks in %SMSRB has to be processed/URL encoded too.

Please help. Thank you.

3 replies

Can you please export your task's description (not xml) so I can take a look? Long-click the task in Tasker->export description Thanks in advance

G
·
```
Task: SMS2Tele
    A1: Variable Set [
         Name: %api_key
         To: 0000000000:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
         Structure Output (JSON, etc): On ]
    A2: Variable Set [
         Name: %chat_id
         To: -0000000000
         Structure Output (JSON, etc): On ]
    A3: HTTP Request [
         Method: GET
         URL: https://api.telegram.org/bot%api_key/sendMessage
         Query Parameters: chat_id:%chat_id
         text:[%SMSRN] %evtprm3
         Timeout (Seconds): 30
         Structure Output (JSON, etc): On ]
```
1. I have redacted my API key and chat ID
2. I have since changed %SMSRB to %evtprm3, but same problem, only the first line of the SMS is received in Telegram
3. That led me to conclude that the contents passed to "text:" is not URL encoded properly
G
·

Hi, can help?

G

hi any ideas? I continue to face this problem

the SMS that causes problems looks something like this.. and any others that contain line breaks

```

XXXXXXXX

---

Your SMS OTP is 000393. Please enter within 2 minutes and never share your OTP with anyone. Sent: 30/08/2024 00:01 PM XXXXXXXXXX.

---

This is an automated message sent by the XXXXXXXXXXXXXX.

```

G

hi how is it?

You can use the "Variable Convert" action to URL encode some text if needed :) Hope this helps.

Topic is closed for comments