javaspring-socialspring-social-twitter

Tweet with Spring-Social-Twitter Api inReplyToStatus doesn't work


I'm trying to send a Tweet as a response (reply) to another tweet that I found via a query.
But although I'm calling https://docs.spring.io/spring-social-twitter/docs/current/apidocs/org/springframework/social/twitter/api/TweetData.html#inReplyToStatus(long) and pass the correct status Id, the tweet doesn't seem to be a reply to the original tweet.

I'm using org.springframework.social:spring-social-twitter:jar:1.1.0.RELEASE in a spring boot app and I've also tried the latest Version 1.1.2.RELEASE, but still doesn't work.

relevant code:

// Tweet tweet comes from a query
// String statusText is some plain text

final Long inReplyToStatus = tweet.getId();
final TweetData tweetData = new TweetData(statusText);
// try to make it a reply, TODO: doesn't work
tweetData.inReplyToStatus(inReplyToStatus);
// send tweet, but doesn't look like an answer.
final Tweet newTweet = this.twitterTemplateFactory.timelineOperations().updateStatus(tweetData);

Do you have any I what's wrong here? Do I have to make it an old-school reply by starting the statusText with "@<usernameOfTheOriginalTweet> ..."?

Help appreciated.


Solution

  • My guess was correct. If you want your answer to be shown as a real reply, you have to set the "inReplyToStatus" field and start the statusText with "@".

    Problem solved.