Skip to content

Instantly share code, notes, and snippets.

@dwongdev
Forked from smiley/README.md
Created November 14, 2019 16:02
Show Gist options
  • Save dwongdev/950cb663d20981cb6425911f2e8fa69c to your computer and use it in GitHub Desktop.
Save dwongdev/950cb663d20981cb6425911f2e8fa69c to your computer and use it in GitHub Desktop.

Revisions

  1. @smiley smiley revised this gist Mar 9, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ Go to https://ifttt.com/ and create an account (if you don't already have one)
    Webhooks are super-customizable and allow you to make pretty well-detailed visuals. However, their format is also somewhat complex to get right without extensive testing, so here's a template which would be useful to most people:
    ```json
    {
    "content": "{{ChannelName}} has gone live on Twitch!",
    "content": "{{ChannelName}} went live on Twitch",
    "embeds": [{
    "title": "{{ChannelUrl}}",
    "url": "{{ChannelUrl}}",
    @@ -40,10 +40,10 @@ Webhooks are super-customizable and allow you to make pretty well-detailed visua
    "text": "{{CreatedAt}}"
    },
    "image": {
    "url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_{{ChannelName}}-1280x720.jpg"
    "url": "{{StreamPreview}}"
    },
    "author": {
    "name": "{{ChannelName}} is now streaming!"
    "name": "{{ChannelName}} is now streaming"
    },
    "fields": [
    {
  2. @smiley smiley revised this gist Mar 8, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -116,5 +116,5 @@ To this:
    **Note:** The image address you just used for your Twitch profile picture may stop working if you change your picture. I'm not sure how Twitch manages those.

    # Credits
    - This guide was adapted from this [YouTube to Discord via IFTTT guide]().
    - This guide was adapted from this [YouTube to Discord via IFTTT guide](https://gist.github.com/Godimas/ae8e7c7cbd6236622c777d6bcb7a6748).
    - The Twitch webhook icon is courtesy of FIVEicons LLC and available under a CC-BY 2.5 license here: https://www.iconfinder.com/icons/318551/twitch_twitch.tv_icon
  3. @smiley smiley revised this gist Dec 2, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -77,6 +77,7 @@ If you'd like to show your Twitch profile picture in the box:
    2. Right-click your profile picture in the **top-right**:

    ![User area on Twitch.tv](https://gist.github.com/smiley/78c1c2a57d17a179a978a1438b389710/raw/screenshot_twitch_userarea.png)

    3. Click "Copy image address"
    4. Paste that address into this blob instead of `<IMAGE_URL>`:
    ```json
  4. @smiley smiley revised this gist Dec 2, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -75,6 +75,7 @@ If you'd like to customize the message text -- "xqcow has gone live on Twitch!"
    If you'd like to show your Twitch profile picture in the box:
    1. Go to Twitch
    2. Right-click your profile picture in the **top-right**:

    ![User area on Twitch.tv](https://gist.github.com/smiley/78c1c2a57d17a179a978a1438b389710/raw/screenshot_twitch_userarea.png)
    3. Click "Copy image address"
    4. Paste that address into this blob instead of `<IMAGE_URL>`:
  5. @smiley smiley revised this gist Dec 2, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -61,7 +61,7 @@ Webhooks are super-customizable and allow you to make pretty well-detailed visua
    }
    ```
    This snippet produces this snippet: (for the channel "xQcow"):
    <IMAGE>
    ![Example using xQcow's channel](https://gist.github.com/smiley/78c1c2a57d17a179a978a1438b389710/raw/screenshot_discord_webhook_template.png)

    ## Custom message
    If you'd like to customize the message text -- "xqcow has gone live on Twitch!" -- change the **content attribute:**
    @@ -75,7 +75,7 @@ If you'd like to customize the message text -- "xqcow has gone live on Twitch!"
    If you'd like to show your Twitch profile picture in the box:
    1. Go to Twitch
    2. Right-click your profile picture in the **top-right**:
    <IMAGE>
    ![User area on Twitch.tv](https://gist.github.com/smiley/78c1c2a57d17a179a978a1438b389710/raw/screenshot_twitch_userarea.png)
    3. Click "Copy image address"
    4. Paste that address into this blob instead of `<IMAGE_URL>`:
    ```json
  6. @smiley smiley revised this gist Dec 2, 2017. 2 changed files with 0 additions and 0 deletions.
    Binary file added screenshot_discord_webhook_template.png
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
    Binary file added screenshot_twitch_userarea.png
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
  7. @smiley smiley created this gist Dec 2, 2017.
    118 changes: 118 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,118 @@
    # Making an automatic Twitch -> Discord notification (using IFTTT)
    So you went live and you want everyone to know. Here's how you do it:

    # Part 1 - Register on IFTTT
    Go to https://ifttt.com/ and create an account (if you don't already have one)

    # Part 2 - Make a Discord Webhook
    - Find the Discord channel in which you would like to send Tweets.
    - In the settings for that channel, find the Webhooks option and create a new webhook.
    **Note: This URL should be kept _private_. It allows anyone to write messages to that specific channel using that specific URL.** Keep it safe!
    ![WebhookDiscord](http://i.imgur.com/PZE2wFu.png)
    - Name the webhook however you like and feel free to change the generic profile picture. I chose [this icon](https://cdn1.iconfinder.com/data/icons/micon-social-pack/512/twitch-128.png) as it fits the circle nicely.
    - Copy the URL somewhere and keep it handy for the next step.

    # Part 3 - Create a new IFTTT applet/recipe
    1. Go [here](https://ifttt.com/create) to create a new "Applet"
    2. Click the big blue "[+] This" and choose "Twitch" (use the search bar to find it quickly)
    3. Connect your account if necessary.
    4. Choose "New stream started by you" (it should be the 2nd option from the left)
    5. Click the big blue "[+] That" and choose "Webhooks"
    6. Choose "Make a web request" (it should be the only option)
    7. Fill in the following details:
    > **URL:** _[your URL from "part 2" above]_
    > **Method:** POST
    > **Content type:** `application/json`
    > **Body:** _[see the snippet below]_
    8. Click "Create Action"
    9. Done!

    # Snippet for "Body"
    Webhooks are super-customizable and allow you to make pretty well-detailed visuals. However, their format is also somewhat complex to get right without extensive testing, so here's a template which would be useful to most people:
    ```json
    {
    "content": "{{ChannelName}} has gone live on Twitch!",
    "embeds": [{
    "title": "{{ChannelUrl}}",
    "url": "{{ChannelUrl}}",
    "color": 6570404,
    "footer": {
    "text": "{{CreatedAt}}"
    },
    "image": {
    "url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_{{ChannelName}}-1280x720.jpg"
    },
    "author": {
    "name": "{{ChannelName}} is now streaming!"
    },
    "fields": [
    {
    "name": "Playing",
    "value": "{{Game}}",
    "inline": true
    },
    {
    "name": "Started at (streamer timezone)",
    "value": "{{CreatedAt}}",
    "inline": true
    }
    ]
    }]
    }
    ```
    This snippet produces this snippet: (for the channel "xQcow"):
    <IMAGE>

    ## Custom message
    If you'd like to customize the message text -- "xqcow has gone live on Twitch!" -- change the **content attribute:**
    ```json
    {
    "content": "{{ChannelName}} has gone live on Twitch!",
    "embeds": [{
    ```

    ## Show your Twitch profile picture in the embed (advanced)
    If you'd like to show your Twitch profile picture in the box:
    1. Go to Twitch
    2. Right-click your profile picture in the **top-right**:
    <IMAGE>
    3. Click "Copy image address"
    4. Paste that address into this blob instead of `<IMAGE_URL>`:
    ```json
    "thumbnail": {
    "url": "<IMAGE_URL>"
    },
    ```
    5. Paste **that** blob below the `image` area in the **main** blob, so that part would change from this:
    ```json
    "footer": {
    "text": "{{CreatedAt}}"
    },
    "image": {
    "url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_{{ChannelName}}-1280x720.jpg"
    },
    "author": {
    "name": "{{ChannelName}} is now streaming!"
    },
    ```
    To this:
    ```json
    "footer": {
    "text": "{{CreatedAt}}"
    },
    "image": {
    "url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_{{ChannelName}}-1280x720.jpg"
    },
    "thumbnail": {
    "url": "<IMAGE_URL>"
    },
    "author": {
    "name": "{{ChannelName}} is now streaming!"
    },
    ```

    **Note:** The image address you just used for your Twitch profile picture may stop working if you change your picture. I'm not sure how Twitch manages those.

    # Credits
    - This guide was adapted from this [YouTube to Discord via IFTTT guide]().
    - The Twitch webhook icon is courtesy of FIVEicons LLC and available under a CC-BY 2.5 license here: https://www.iconfinder.com/icons/318551/twitch_twitch.tv_icon