The changes to replies have not yet been rolled out.
All of the changes are documented here:
1 Like
I need to add the URL(DM deep link) along with 140 characters Is it possible.
I can able to do only 2 changes:
a) Adding image,GIF along with 140 characters.
b) Quote tweet excluding 140 charcters.
I am unable to add prefix and suffix(URL) along with 140 characters.As your comment prefix is not rolled out yet. What about URL(DM deep links) we can do along with 140.unable to add URL along with 140.IF it is possible send be the API used documentation.
1 Like
The page I linked to above contains the documentation - use the attachment_url parameter to add the DM
deep link.
1 Like
But I dont find any sufficient documentation(API) in which attachment_url parameter need to be attached for DM deep links. Can you provide me the sufficient API for Attachment_url.
When I add attachement_url in media/upload and statuses/update getting error:{ errors: [ { code: 44, message: ‘attachment_url parameter is invalid.’ } ] }
1 Like
What value are you passing? It only applies on statuses/update. You cannot have a direct message link and media attached to the same status.
1 Like
Here’s an example using twurl
$ twurl -d "status=contact... &attachment_url=https://twitter.com/messages/compose?recipient_id=54931584" "/1.1/statuses/update.json"
You obviously need to insert a valid recipient ID (i.e. matching your own user ID), and to have “Receive DMs from anyone” enabled in your user settings, for this to work.
1 Like
var b64content = fs.readFileSync('/home/sivasaivarma/Day Users/sivasaivarma/personal/bigdata/images/leadoid.jpg', { encoding: 'base64' })
T.post('media/upload', { media_data: b64content}, function (err, data, response) {
var mediaIdStr = data.media_id_string
var altText = "Small flowers in a planter on a sunny balcony, blossoming."
var meta_params = { media_id: mediaIdStr, alt_text: { text: altText } }
T.post('media/metadata/create', meta_params, function (err, data, response) {
if (!err) {
var params = { status: '@sivasai Nepal diverse and beautiful landscape with these adventure photos new to nepal came here for outing to see. on.natgeo.com/2dYabpI', media_ids: [mediaIdStr] }
T.post('statuses/update', params, function (err, data, response) {
console.log(data)
})
}
})
})
var params = { status: 'LEADoid', attachment_url: 'http://bit.ly/2kJaDc1'}
T.post('statuses/update', params, function (err, data, response) {
console.log(data)
})
})
I am able to add image aganist 140 characters. but at the same time if i am adding attachment_url with statuses/update it is showing error.I dont find any attachment_url parameter in statuses/update in the documentation you sent.I am working on nodejs with Twit API
1 Like
That is not a valid attachment url. It must be a Twitter direct message deep link. You cannot attach arbitrary URLs in this manner. Also, you cannot attach an image to a Tweet and include a DM deep link at the same time.
Your second code block does not make sense as you are not uploading any media but you’re trying to update a status inside the upload callback.
I’ve provided an example and a link to the documentation so I think this is all we can do to help at the moment.
1 Like
var b64content = fs.readFileSync('/home/sivasaivarma/Day Users/sivasaivarma/personal/bigdata/images/leadoid.jpg', { encoding: 'base64' })
T.post('media/upload', { media_data: b64content}, function (err, data, response) {
var mediaIdStr = data.media_id_string
var altText = "Small flowers in a planter on a sunny balcony, blossoming."
var meta_params = { media_id: mediaIdStr, alt_text: { text: altText } }
T.post('media/metadata/create', meta_params, function (err, data, response) {
if (!err) {
var params = { status: '@sivasai Nepal diverse and beautiful landscape with these adventure photos new to nepal came here for outing to see. on.natgeo.com/2dYabpI', media_ids: [mediaIdStr], attachment_url: 'https://leadoid.leadoid.com/#!/lead/landingpage/56f93a04a084d542152d6f63/589c70ccb4c4263b0b498e19/55b9cb83cd965bf950fbf386' }
T.post('statuses/update', params, function (err, data, response) {
console.log(data)
})
}
})
})
You cannot attach images and also use an attachment URL.
You cannot pass arbitrary URLs in the attachment URL parameter. This is clearly stated in the documentation.
1 Like
var params = { status: '@sivasai Nepal diverse and beautiful landscape with these adventure photos new to nepal came here for outing to see filter streams to find', attachment_url: 'https://t.co/VbmGKY9' }
T.post('statuses/update', params, function(error, data, response){
if(error){
console.log(error);
}
console.log(data);
console.log(response);
});
Hi @andypiper Thank you, attachment_url is working under statuses/update without any errors but i am not getting any tweet in the twitter post. Any Reason.
1 Like
There are some issues with the attachment_url. unable to post the tweet using attachment_url.Is there any alternative to add url aganist 140 characters.By adding attachment_url i am able to run but the tweet is not posting on the tweet.
1 Like
What URL are you attempting to add?
https://leadoid.leadoid.com/#!/lead/landingpage/56f93a04a084d542152d6f63/589c70ccb4c4263b0b498e19/55b9cb83cd965bf950fbf386
when i added above link it is showing error. for sample i have attached below url still not getting output
https://t.co/VbmGKY9
if those are wrong send me the example URL which supports twitter.
var params = { status: '@sivasai Nepal diverse and beautiful landscape with these adventure photos new to nepal came here for outing to see. ', attachment_url: 'https://t.co/VbmGKY9'}
T.post('statuses/update', params, function(error, data, response){
if(error){
console.log(error);
}
console.log(data);
console.log(response);
});
i added below link attachment url too but still not working.
https://leadoid.com/#!/home
I am having bitly links will it not be accepted?
http://bit.ly/2kJaDc1 i am passing this as attachment_url so I need to pass this URL in the twitter post.
The documentation and all of my previous answers are extremely clear on this. You cannot add arbitrary URLs via attachment_url.
A URL at the end of Tweets generated from attaching photos, a video, GIF, poll, Quote Tweet, or DM deep link will also not count towards the character limit (URLs typed or pasted inside the Tweet will be counted towards the character limit as they do today).
var Twit = require('twit');
var fs = require('fs');
var T = new Twit({
consumer_key: ''
, consumer_secret: ''
, access_token: ''
, access_token_secret: ''
});
var params = { status: '@sivasai Nepal diverse and beautiful landscape with these adventure photos new to nepal came here for outing to see filter streams to find', attachment_url: 'http://www.liveworld.com/'}
T.post('statuses/update', params, function(error, data, response){
if(error){
console.log(error);
}
console.log(data);
console.log(response);
});
Is this is right declaration. after executing this code i am unable to get any post in the tweet.how ever the url may be. I am wondering that when ever attachment_url parameter is used it is executing without any eroor but not displays any output.
That URL is NOT valid for use in that parameter.
In order for a URL to not be counted in the body of the Tweet, a new attachment_url parameter will be available on statuses/update to allow a client to attach it to the Tweet without explicitly adding it to the Tweet text. This URL must be a Tweet permalink, or DM deep link. Arbitrary, non-Twitter URLs should remain in the Tweet text and will count against the 140 character limit. URLs passed to the attachment_url parameter not matching either a Tweet permalink or DM deep link will fail at Tweet creation and cause an exception.
1 Like