Data Manipulation Plugin: javascript code Sending an API call is not sending in "Form Events"> Value Changes

Trying to make api post request to beeceptor online mock api but the request is not sending. Sending the api request through Curl command tool or vscode works with no issue.
I am putting the code here, so that as soon as the panel values(Voltage) changes it is supposed to execute the code?

async function sendMessage() {
  const apiUrl = '';

  try {
    const response = await fetch(apiUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json' // beeceptor
      body: JSON.stringify({ "data": "Hello from grafana" }) // beeceptor

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    const responseData = await response.text();
    console.log('Response:', responseData);
  } catch (error) {
    console.error('Error sending message:', error);

I tried from VSCode and the code works, mock api receives the post request.

Is grafana blocking anything?

1 Like

@wxyzabc190 Form Events is one of the latest features we introduced recently. I am not sure if promises are supported.

Please open an issue in the GitHub repository. I will ask the team to take a look.