Twitter.create keeps failing, unsure how to debug

Hi. I’m very new to scripting with Drafts. I tried to use the tweet storm action (http://actions.getdrafts.com/a/1Hu), but it keeps failing at the Twitter.create() command. It fails regardless of whether I specify no arg or my Twitter identifier number as an arg. For the record, I am able to post a tweet with the standard Twitter action and I have authorized Twitter. Any tips on how to fix or even debug this problem? Thank you!

Did you edit the original action at all? If you reinstall and make no changes does it still exhibit the problem? Are you updated to the 5.0.5 release that came out yesterday?

Also, the “twitterIdentifier” is just a string value. If you only have one twitter account, just leave it “” as in the action default - it has nothing to do with your actually Twitter account.

1 Like

Oh. That’s very embarrassing. I updated Drafts on one device and then tested the action on the other device (which didn’t have the update). Oops! It works now. Cool! THANK YOU FOR THE AMAZING APP. One of the most important apps on my iPhone and iPad… :black_heart::blue_heart::orange_heart:

4 Likes

Hi

I’m trying to cut a longer text with Twitter Splitter, which gives me 280 characters max. Then I am trying to use Tweet Storm to publish it. However, there is a limit of 248 characters.

How can I edit the script on iPhone? I guess if I change the 248 to 280 it should work? Or is there a solution straight out of the box?

I am not at all experienced with Drafts, although I am using it regularly for some basic stuff.

Regards

Gerhard

If you change the const maxCharacters = 248; value at the top of the Tweet Storm script it should alter what the script considers too many characters.

Don’t go all the way to 280, however. As the script adds at least 6 characters to each tweet for the thread count (like (1/3), and you might need additional character if you use Emoji or other multi-byte characters, because Twitter will count those as more than one. You can see Twitter’s docs on how characters are counted.

Thank you so much. That’s what I thought. 270 should be fine.

However, the question is how can I edit the script. I have been able to copy and edit the script in Drafts or Notes but how do I get it to the script location, which in my case is Tools. And all this on the iPhone.

Where can I access the scripts and edit them?

Tap and hold on the action, select “Edit” on iOS, or right-click > Edit on Mac. The functionality is in the action steps. Start with the action docs for basics on editing actions: Configuring Actions - Drafts User Guide

I don’t get it. I must be missing something very fundamental. How do I activate the script? Where are the scripts stored?

I long press the Twitter Storm button in Tools mode. Nothing happens.

Are you on iOS or Mac?

I am on iOS. I think I have found it, the pull-in menu (action menu) from the right. The Twitter Storm action didn’t show. By chance I searched for it and found it in the search result. From there it looks like I can edit the script. But I need to get the Pro version it looks like.

Am I on the right track?

Yes, sounds like it.

Thank you ever so much for all your help. Very grateful. And what a nice community it is. I’ll have to dive deeper into all this.

Regards

Gerhard

I have a problem with the Twitter Splitter script from you. After activating the script it always leaves a part of text out. Any idea how to fix it?

What does that mean? Specifically “a part” - it is a little vague; it could be an arbitrary number of characters at the start, in the middle, at the end, after a specific number of characters, something before some sort of unusual character such as an emoji.

Can you provide an example or two with details of your issue in order to help debug your issue?

Hi,

Here are some more details about the issue. Below is the text I tried to split. It split correctly at 265 and 269 characters but the last and remaining part of 211 characters disappeared. I tried to delete the Twitter Splitter but it did not delete. I reinstalled it with the option to override. Still the problem persists:

"The mind, the senses and the vital force, or living entity, have forms, although they are not visible to the naked eye. Form rests in the subtle existence in the sky, and internally it is perceived as the veins within the body and the circulation of the vital air.

SPLIT

Externally there are invisible forms of sense objects. The production of the invisible sense objects is the external activity of the ethereal element, and the circulation of the vital air and blood is its internal activity. That subtle forms exist in the ether has been

•••

The Splitter cuts off the text at the end. Here is the cut off remaining text of 211 characters:

proven by modern science by the transmission of television, by which forms or photographs of one place are transmitted to another place by the action of the ethereal element. That is very nicely explained here.

•••

I made a new installation (now I have 2 scripts) but it did not make any difference. I also tried all 3 options, add index, no index, and no space for index. Still the same problem. I tried with a different text and it appears the size of the dropped text is not consistent.

Does your preview look something like this then and it is just the tweet that is omitted or is it being dropped in the preview?

FOR INFO: expand for draft content used - as best I could fit it to the prior description
The mind, the senses and the vital force, or living entity, have forms, although they are not visible to the naked eye. Form rests in the subtle existence in the sky, and internally it is perceived as the veins within the body and the circulation of the vital air. 

Externally there are invisible forms of sense objects. The production of the invisible sense objects is the external activity of the ethereal element, and the circulation of the vital air and blood is its internal activity. That subtle forms exist in the ether has been 

proven by modern science by the transmission of television, by which forms or photographs of one place are transmitted to another place by the action of the ethereal element. That is very nicely explained here.

I am not speaking about the Tweet Storm, which works ok. It’s about the Twitter Splitter. I want to split the tweets first with Twitter Splitter, replace/delete the = signs to get paragraphs and then use Tweet Storm to post to Twitter.

It would be great if Tweet Storm could automatically split the tweets but it doesn’t, so to speak an action that combines Twitter Splitter and Tweet Storm.

Maybe someone can write such a script with perhaps splitting at 270 characters at most to have space for (16/20) etc.

Helps to be specific about the action you are referring to and where it came from…guess you mean this “Twitter Splitter” action in the Directory, which was uploaded by @RosemaryOrchard. (There are lots of actions around from different sources, so specifics help).

That action does appear to have a bug of omission. After looping over the text, it fails to add that last remaining chunk of text to the array of tweets. You can fix by adding a line, as shown below:

while (content.length > maxLength) {
	var s = content.substr(0, maxLength);
	var i = s.lastIndexOf(" ");
	tweets.push(content.substr(0, i));
	content = (content.substr(i+1, content.length));
}
tweets.push(content); // <= ADD THIS LINE

@RosemaryOrchard may well upload a fixed version when she sees this as well.

1 Like

That would be great. This JavaScript or whatever it is is another world to me :slight_smile: