# Getting tweets into a topic via Discourse API

**URL:** https://meta.discourse.org/t/getting-tweets-into-a-topic-via-discourse-api/101172
**Category:** Development
**Created:** [November 2, 2018, 8:45pm UTC](https://meta.discourse.org/t/getting-tweets-into-a-topic-via-discourse-api/101172 "2018-11-02T20:45:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![SebastianADW](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@SebastianADW](https://meta.discourse.org/u/SebastianADW)
#### Post date: [November 2, 2018, 8:45pm UTC](https://meta.discourse.org/t/getting-tweets-into-a-topic-via-discourse-api/101172/1 "2018-11-02T20:45:08Z")

</div>

I am trying to create a kind of twitter bot as a discourse plugin.  
I already managed to crawl tweets with the twitter gem (BTW. i had to require tons of gems in the plugin.rb with `gem 'gemname', '0.4.2', {require: false}` to get it working, is there a cleaner way to do it?)

But now i want to send those tweets in a discourse topic. Lets say, the plugin checks every 10 seconds if there is a new tweet, and if so it creates a new reply to the topic.  
I am not really sure how to use the Discourse API to achieve that.

What i am also curious about would be to get it managed to just get any kind of input on my discourse server via api - Would really appreciate if someone could help me there.  
And: My tweets are at the moment as a hash map in a variable tweets. Can i display the variable in any way on my discourse server just for testing purposes?  
For example show tweets.to\_a.last.full\_text and then somewhere the last crawled tweet is showing up?

---

<div class="post-metadata">

### Author: ![Federico\_Tomassetti](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/federico_tomassetti/32/166420_2.png) [@Federico\_Tomassetti](https://meta.discourse.org/u/Federico_Tomassetti)
#### Post date: [January 24, 2020, 6:37pm UTC](https://meta.discourse.org/t/getting-tweets-into-a-topic-via-discourse-api/101172/2 "2020-01-24T18:37:43Z")

</div>

I would like to go the opposite: tweeting every topic

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [January 24, 2020, 6:47pm UTC](https://meta.discourse.org/t/getting-tweets-into-a-topic-via-discourse-api/101172/3 "2020-01-24T18:47:16Z")

</div>

take a look at:

> [@Possible to have a webhook only for new topics, not for replies etc.?](https://meta.discourse.org/t/possible-to-have-a-webhook-only-for-new-topics-not-for-replies-etc/105701):
>
> Currently using a webhook “Topic event” to notify Zapier to post to Twitter. My intention is to have new topics trigger a Tweet. Now Zapier told me they halted my “Zap” because of violating the rule that says, no duplicate Tweets are allowed. In my opinion this was the case, because the webhook is not only called for a new topic, but also for replies to a topic or when a topic was altered. My question: Is it possible to further narrow it down, so that the webhook only is called when a new to…
