Hello,
I am working on an outgoing webhook script in Rocket.Chat and trying to make an HTTP request using the HTTP
helper as described in the documentation. However, when I attempt to use HTTP
, I encounter the following error:
ReferenceError: HTTP is not defined
Here is the relevant part of my script:
const apiUrl = `https://rocket.example.com/api/v1/users.info?username=${Username}`;
const apiHeaders = {
'X-Auth-Token': 'your-auth-token', // Authentication token
'X-User-Id': 'your-user-id' // Admin user ID
};
const response = HTTP('GET', apiUrl, { headers: apiHeaders });
I have double-checked the authentication details, and they are correct. Based on the documentation, the HTTP
helper should be available for outgoing webhook scripts. However, it seems like HTTP
is not recognized or defined in the script environment.
Can someone confirm:
- Is the
HTTP
helper supported in the latest version of Rocket.Chat? - If it is supported, how should I correctly use it to make external HTTP requests within an outgoing webhook script?
- If it is not supported, is there an alternative method to perform HTTP requests in this context?
I am using Rocket.Chat version 6.13.0.
Thank you for your assistance!
Carlos