Versions

  • v16

    1/3/2024
    Open: Version
    Changes from v15 to v16
    +1
    -1
    ⦚ 16 unchanged lines ⦚
    throw new Error("Error: " + message);
    }
    return val await resp.json();
    }


    ⦚ 16 unchanged lines ⦚
    throw new Error("Error: " + message);
    }
    return await resp.json();
    }


  • v15

    1/3/2024
    Open: Version
    Changes from v14 to v15
    +2
    -6
    async function slackPost (token, channel, text) {
    const resp = await fetch(
    `https://slack.com/api/chat.postMessage`,
    ⦚ 13 unchanged lines ⦚
    throw new Error("Error: " + message);
    }
    let val = await resp.json();
    return val
    }

    const token = Deno.env.get("SLACK_TOKEN")
    const res = await slackPost(token, "C06CQ9TR2CR", "ignore-this")
    console.log(res)
    export async function slackPost(token, channel, text) {
    const resp = await fetch(
    `https://slack.com/api/chat.postMessage`,
    ⦚ 13 unchanged lines ⦚
    throw new Error("Error: " + message);
    }
    return val await resp.json();
    }


  • v14

    1/3/2024
    Open: Version
    Changes from v13 to v14
    +0
    -0
    ⦚ 25 unchanged lines ⦚
    ⦚ 25 unchanged lines ⦚
  • v13

    1/3/2024
    Open: Version
    Changes from v12 to v13
    +2
    -2
    ⦚ 7 unchanged lines ⦚
    'Content-type': 'application/json; charset=utf-8',
    },
    body: {
    channel,
    text
    }
    })
    if (!resp.ok) {
    ⦚ 10 unchanged lines ⦚
    ⦚ 7 unchanged lines ⦚
    'Content-type': 'application/json; charset=utf-8',
    },
    body: JSON.stringify({
    channel,
    text
    })
    })
    if (!resp.ok) {
    ⦚ 10 unchanged lines ⦚
  • v12

    1/3/2024
    Open: Version
    Changes from v11 to v12
    +1
    -1
    ⦚ 21 unchanged lines ⦚

    const token = Deno.env.get("SLACK_TOKEN")
    const res = await slackPost(token, "user-alerts", "ignore-this")
    console.log(res)
    ⦚ 21 unchanged lines ⦚

    const token = Deno.env.get("SLACK_TOKEN")
    const res = await slackPost(token, "C06CQ9TR2CR", "ignore-this")
    console.log(res)
  • v11

    1/3/2024
    Open: Version
    Changes from v10 to v11
    +1
    -1
    ⦚ 5 unchanged lines ⦚
    headers: {
    'Authorization': `Bearer ${token}`,
    'Content-type: application/json; charset=utf-8',
    },
    body: {
    ⦚ 15 unchanged lines ⦚
    ⦚ 5 unchanged lines ⦚
    headers: {
    'Authorization': `Bearer ${token}`,
    'Content-type': 'application/json; charset=utf-8',
    },
    body: {
    ⦚ 15 unchanged lines ⦚
  • v10

    1/3/2024
    Open: Version
    Changes from v9 to v10
    +1
    -1
    ⦚ 5 unchanged lines ⦚
    headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'utf-8',
    },
    body: {
    ⦚ 15 unchanged lines ⦚
    ⦚ 5 unchanged lines ⦚
    headers: {
    'Authorization': `Bearer ${token}`,
    'Content-type: application/json; charset=utf-8',
    },
    body: {
    ⦚ 15 unchanged lines ⦚
  • v9

    1/3/2024
    Open: Version
    Changes from v8 to v9
    +1
    -1
    ⦚ 5 unchanged lines ⦚
    headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json',
    },
    body: {
    ⦚ 15 unchanged lines ⦚
    ⦚ 5 unchanged lines ⦚
    headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'utf-8',
    },
    body: {
    ⦚ 15 unchanged lines ⦚
  • v8

    1/3/2024
    Open: Version
    +25
    -0

    async function slackPost (token, channel, text) {
    const resp = await fetch(
    `https://slack.com/api/chat.postMessage`,
    {
    method: "POST",
    headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json',
    },
    body: {
    channel,
    text
    }
    })
    if (!resp.ok) {
    let { message } = await resp.json();
    throw new Error("Error: " + message);
    }
    let val = await resp.json();
    return val
    }

    const token = Deno.env.get("SLACK_TOKEN")
    const res = await slackPost(token, "user-alerts", "ignore-this")
    console.log(res)
Updated: January 3, 2024