This topic was automatically generated from Slack. You can find the original thread here.
this problem send webhook telegram bot === Request path contains unescaped characters
This topic was automatically generated from Slack. You can find the original thread here.
this problem send webhook telegram bot === Request path contains unescaped characters
HI , can you show me exactly where you’re seeing this error (via screenshot), and share the exact text of the error message you’re seeing?
sent alert this message error = but send only text without emoji and enter per line is true
I’m making an HTTP request from Pipedream and seeing an error:
TypeError: Request path contains unescaped characters
How do I fix this?
It seems like you’re trying to make an HTTP request with a URL that contains unescaped characters. To fix this issue, you can use the encodeURIComponent
function to properly escape the characters in your URL or its parameters. Here’s an example of how to use encodeURIComponent
in a Pipedream component: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { url: { type: "string", label: "URL to make request to", }, param: { type: "string", label: "Query parameter", }, }, async run({ steps, $ }) { const escapedParam = encodeURIComponent(this.param); const requestUrl = `${this.url}?param=${escapedParam}`; const response = await axios($, { method: "GET", url: requestUrl, }); return response; }, });
In this example, the param
value is escaped using encodeURIComponent
before being added to the URL. Make sure to replace the url
and param
values with the appropriate values for your use case.
can you show me exactly how you’re trying to construct the URL in that step?
Where should I put the code you sent me?
I’d like to see exactly how you’re sending data to Telegram in your HTTP request step so I can help show you where you should encode the data
basically, some characters are “reserved” in URLs, and you need to encode them before sending them in HTTP requests.
Are you passing any data via the Params section of the HTTP request builder? That should also automatically encode them.
steps.trigger{2}
context{15}
id:
2PU4DmSabde21GCIrjFEUlyHwxJ
ts:
2023-05-07T22:23:28.419Z
pipeline_id:
null
workflow_id:
p_yKCl5L5
deployment_id:
d_v7sVWBk6
source_type:
COMPONENT
verified:
false
hops:
null
test:
false
replay:
false
-more-
event{7}
method:
POST
path:
/
query{0}client_ip:
52.32.178.7
url:
https://eobast9k902b4p3.m.pipedream.net/
headers{5}
host:
[eobast9k902b4p3.m.pipedream.net](http://eobast9k902b4p3.m.pipedream.net)
content-length:
119
user-agent:
Go-http-client/1.1
content-type:
text/plain; charset=utf-8
Copy Path•
Copy Valueaccept-encoding:
gzip
body 🍄 MEGA 💰 [ STRATEGY_LAND ] 💰
🍄 MEGA 💰 [ STRATEGY_LAND ] 💰
🍄 MEGA 💰 [ STRATEGY_LAND ] 💰
Sorry, in the custom_request
step, can you expand that and show me the URL you’re trying to make a request to?
not send emoji in message
Thanks. So instead of putting the parameters all in the URL, can you keep everything up until /sendMessage
and remove the ?
and everything after? Then click on the Params section and add params like so:
chat_id
: (value of chat ID)
text
: {{steps.trigger.event.body}}
Passing these as params, instead of stuffing everything in the URL, should fix the encoding error
My channel is private and I got this link from the site itself tips:telegram [Galileo Labs]
That’s fine, you’re just changing the structure of the request and sending the same data
problem is send emoji by message without emoji no problem
by message = error