Edits history of script submission #113 for ' Trigger Windmill webhook with native fetch API (windmill)'

  • deno
    /**
     * Interact with Windmill's webhooks using standard fetch.
     *
     * @param webhookUrl {string} Webhook URL from Script Details page
     * @param scriptArgs {Object} JSON with arguments to pass
     * to the underlying script/flow
     * @param token {string} User token from User Settings page
     */
    export async function main(
      webhookUrl: string = "https://app.windmill.dev/api...",
      scriptArgs = { "arg1": "Welcome" },
      token: string = "supersecret",
    ) {
      const options = {
        method: "POST",
        headers: {
          "Authorization": `Bearer ${token}`, 
          "Content-Type", "application/json"
        },
        body: JSON.stringify(scriptArgs),
      };
      const response = await fetch(webhookUrl, options);
      const data = await response.json();
      return data;
    }
    

    Submitted by lplit 1360 days ago

  • deno
    /**
     * Interact with Windmill's webhooks using standard fetch.
     *
     * @param webhookUrl {string} Webhook URL from Script Details page
     * @param scriptArgs {Object} JSON with arguments to pass
     * to the underlying script/flow
     * @param token {string} User token from User Settings page
     */
    export async function main(
      webhookUrl: string = "https://app.windmill.dev/api...",
      scriptArgs = { "arg1": "Welcome" },
      token: string = "supersecret",
    ) {
      const options = {
        method: "POST",
        headers: {
          "Authorization": `Bearer ${token}, 
          "Content-Type", "application/json"`
        },
        body: JSON.stringify(scriptArgs),
      };
      const response = await fetch(webhookUrl, options);
      const data = await response.json();
      return data;
    }
    

    Submitted by lplit 1360 days ago

  • deno
    /**
     * Interact with Windmill's webhooks using standard fetch.
     *
     * @param webhookUrl {string} Webhook URL from Script Details page
     * @param scriptArgs {Object} JSON with arguments to pass
     * to the underlying script/flow
     * @param token {string} User token from User Settings page
     */
    export async function main(
      webhookUrl: string = "https://app.windmill.dev/api...",
      scriptArgs = { "arg1": "Welcome" },
      token: string = "supersecret",
    ) {
      const options = {
        method: "POST",
        {
          "Authorization": `Bearer ${token}, 
          "Content-Type", "application/json"`
        },
        body: JSON.stringify(scriptArgs),
      };
      const response = await fetch(webhookUrl, options);
      const data = await response.json();
      return data;
    }
    

    Submitted by lplit 1360 days ago

  • deno
    /**
     * Interact with Windmill's webhooks using standard fetch.
     *
     * @param webhookUrl {string} Webhook URL from Script Details page
     * @param scriptArgs {Object} JSON with arguments to pass
     * to the underlying script/flow
     * @param token {string} User token from User Settings page
     */
    export async function main(
      webhookUrl: string = "https://app.windmill.dev/api...",
      scriptArgs = { "arg1": "Welcome" },
      token: string = "supersecret",
    ) {
      const headers = new Headers();
      headers.append("Authorization", `Bearer ${token}`);
      headers.append("Content-Type", "application/json");
      const options = {
        method: "POST",
        headers,
        body: JSON.stringify(scriptArgs),
      };
      const response = await fetch(webhookUrl, options);
      const data = await response.json();
      console.log(data);
      return data;
    }
    

    Submitted by lplit 1364 days ago

  • deno
    /**
     * Interact with Windmill's webhooks using standard fetch.
     *
     * @param webhookUrl {string} Webhook URL from Script Details page
     * @param scriptArgs {Object} JSON with arguments to pass
     * to the underlying script/flow
     * @param token {string} User token from User Settings page
     */
    export async function main(
      webhookUrl: string = "https://app.windmill.dev/api/w/windmill-labs/jobs/run/p/u/bot/hello_world_deno",
      scriptArgs: Object = { "x": "Welcome" },
      token: string = "supersecret",
    ) {
      const headers = new Headers();
      headers.append("Authorization", `Bearer ${token}`);
      headers.append("Content-Type", "application/json");
      const options = {
        method: "POST",
        headers,
        body: JSON.stringify(scriptArgs),
      };
      const response = await fetch(webhookUrl, options);
      const data = await response.json();
      console.log(data);
      return data;
    }
    

    Submitted by lplit 1364 days ago

  • deno
    /**
     * Interact with Windmill's webhooks using standard fetch.
     *
     * @param webhookUrl {string} Webhook URL from Script Details page
     * @param scriptArgs {Object} JSON with arguments to pass
     * to the underlying script/flow
     * @param token {string} User token from User Settings page
     */
    export async function main(
      webhookUrl: string = "https://app.windmill.dev/...",
      scriptArgs: Object = { "a": 1 },
      token: string = "supersecret",
    ) {
      const headers = new Headers();
      headers.append("Authorization", `Bearer ${token}`);
      headers.append("Content-Type", "application/json");
      const options = {
        method: "POST",
        headers,
        body: JSON.stringify(scriptArgs),
      };
      const response = await fetch(webhookUrl, options);
      const data = await response.json();
      console.log(data);
      return data;
    }
    

    Submitted by lplit 1364 days ago