Automatically Share your Tweets with Discord Channels | WayScript Automation
Tags: startup, wayscript, tutorial, serverless
Published: 2020-12-08 13:58:32

Introduction
------------

If you are running a messaging channel, you might want the members to not miss any post on your social media.  
Using Wayscript, you can integrate Twitter with Discord and share regularly your tweets seamlessly.  
Let’s build this script.

Prerequisites
-------------

There are no prerequisites for this script. However, here are some documentation you might find useful.

*   [Working with Time Trigger](https://docs.wayscript.com/library/triggers/time-trigger)
*   [Working with Discord](https://docs.wayscript.com/library/modules/discord)
*   [Working with Twitter](https://docs.wayscript.com/library/modules/twitter)
*   [Working with Loops](https://docs.wayscript.com/library/logic/loop)

Trigger
-------

We want to post the Tweets regularly in the Discord channel. Let’s choose time so all tweets within 24 hours will be posted automatically in the channels.  
Add it as a Trigger.  
  

![tutorial step #1](https://wayscript.com/blog_img/154/1.png)

  
  
You have a lot of options when configuring the Time Trigger. For this post, the script will run every day. Once you’ve chosen this mode, you will have to set the time. Choose the most suitable time for you.  
  

![tutorial step #1](https://wayscript.com/blog_img/154/2.png)

  
  

Retrieve Tweets
---------------

Wayscript provides a Twitter module with a lot of functionalities for your needs.  
Add it as a new step.  
  

![tutorial step #1](https://wayscript.com/blog_img/154/3.png)

  
  
Now, add your account and choose My Profile Timeline for the mode. This mode pulls data from your timeline.  
Once it’s done, you’ll have to choose the outputs. The Tweets outputs will work best here.

Loop through Tweets and Post on Discord
---------------------------------------

The output (Tweets) we are working with is actually a list of tweets. To better work with it, we’ll use a loop, get each item (Tweets\_item) according to the index and post it on Discord.  
Fortunately, Wayscript provides many options for loops but here we will use the Loop module.  
Add as a new step.  
  

![tutorial step #1](https://wayscript.com/blog_img/154/4.png)

  
  
This module needs an input (a list) to work. Add the Tweets variable.  
  

![tutorial step #1](https://wayscript.com/blog_img/154/5.png)

  
  
Now, each Tweets\_Item contains information we need for a tweet such as content and link. This will be used in the Discord module.  
Add it as a new step in the Loop.  
  

![tutorial step #1](https://wayscript.com/blog_img/154/6.png)

  
  
The configuration for the Discord module is simple. We want here to only write a message on the channel. Then you can choose the channel, the bot name and write your message.  
  

![tutorial step #1](https://wayscript.com/blog_img/154/7.png)

  
  
Now, turn on the Trigger and Wayscript will handle the automation of the script for you.  
  

![tutorial step #1](https://wayscript.com/blog_img/154/8.png)

  
  

Conclusion
----------

Questions about this script or anything else? Join our [Discord](https://discord.gg/VWbXSbj). We're always around to help. If you want to work with the full script template, just find it [here](https://wayscript.com/user/mangabo_kolawole/YLdFfH_N).