DEV Community

Derrick Sherrill for WayScript

Posted on

Send Messages to Discord Whenever a New PR from Github occurs

Introduction

Someone just made a commit in your software development tools and you want you and your team to get notified. With Wayscript, you can seamlessly integrate Discord and Github to automatically receive messages about pull requests in your channels.

Let’s build this integration.

Prerequisites

No prerequisites but here are some documentation you might find useful.

Trigger

For this example, we want the script to run when there is Pull Request in Github. Well, Wayscript provides a Github Trigger that can warn as well about new pull requests, new issues, and branch events. Add Github as a Trigger.

Adding the trigger

Once it’s done, you’ll have to add your Github account. After this, select a repository and the mode. Here we’ll work with Pull Requests Events.

Configuring Github Trigger

The panel will update and you’ll notice Outputs. These are just the common information you can find about a Pull Request.

Select the title, the username, the URL, and the number.

Selecting outputs

The Github Trigger is ready, configured with the outputs we need. Let’s write the message we want to send.

Discord message

Wayscript also provides a Discord module to easily write or read messages. Add it as a new step in your workflow and let’s configure it.

Adding Discord module

After selecting the discord server you want to work with, you can choose the channel and select a mode(Read or Write).

Configuring Discord

Enter the message you want to send. You can also specify a name that the bot should use and an image URL for the bot to use as its icon.

Discord message

Good, We’re almost done. Turn on the GitHub trigger.

Trigger On

Now, Wayscript handles the automation of this script for you. :)

Conclusion

If there's any questions feel free to message us on discord. We're happy to help! If you want to see this full script template, you can find it here.

Top comments (0)