Skip to main content

Create custom tweet

Creates a tweet with custom content

Function CreateCustomTweet(Val Text = "", Val MediaArray = "", Val PollOptionsArray = "", Val PollDuration = "", Val Parameters = "") Export

ParameterCLI optionTypeRequiredDescription
Text--textStringTweet text
MediaArray--mediaArray of String, BinaryDataArray of binary data or file paths
PollOptionsArray--optionsArray of StringArray of poll options, if necessary
PollDuration--durString, NumberPoll duration if necessary (poll without duration is not created)
Parameters--authStructure Of StringAuthorization data. See GetStandardParameters

Returns: Map Of KeyAndValue - serialized JSON response from Twitter

tip

Parameters with Binary data type can also accept file paths on disk and URLs


1C:Enterprise/OneScript code example
    Parameters = GetTwitterAuthData();
Text = "TestTweet" + String(New UUID);

Image1 = "https://hut.openintegrations.dev/test_data/picture.jpg"; // URL, Binary Data or File path
Image2 = "https://hut.openintegrations.dev/test_data/picture2.jpg"; // URL, Binary Data or File path

ImageArray = New Array;
ImageArray.Add(Image1);
ImageArray.Add(Image2);

MediaArray = OPI_Twitter.UploadAttachmentsArray(ImageArray, "tweet_image", Parameters);
Result = OPI_Twitter.CreateCustomTweet(Text, MediaArray, , , Parameters);
    # JSON data can also be passed as a path to a .json file

oint twitter CreateCustomTweet \
--text "TestTweetb706b78a-d26f-4ba7-9fac-614dfcf05a65" \
--media "['2036683759722848256','2036683773644091393']" \
--auth "{'redirect_uri':'https://hut.openintegrations.dev/melezh/6ad91cc8b','client_id':'***','client_secret':'***','access_token':'***','refresh_token':'***','oauth_token':'***','oauth_token_secret':'***','oauth_consumer_key':'***','oauth_consumer_secret':'***'}"
Result
{
"data": {
"id": "2036728001908396498",
"edit_history_tweet_ids": [
"2036728001908396498"
],
"text": "TestTweet5c94fedf-aac2-44e5-ac76-d5797b8f6be4 https://t.co/mWXx1Q3qX8"
}
}