Skip to main content

Create poll tweet

Creates a tweet with a poll

Function CreatePollTweet(Val Text, Val OptionArray, Val Duration, Val Parameters = "") Export

ParameterCLI optionTypeRequiredDescription
Text--textStringTweet text
OptionArray--optionsArray of StringPoll options array
Duration--durationString, NumberPoll duration
Parameters--authStructure Of StringAuthorization data. See GetStandardParameters

Returns: Map Of KeyAndValue - serialized JSON response from Twitter


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

AnswersArray = New Array;
AnswersArray.Add("Option 1");
AnswersArray.Add("Option 2");

Result = OPI_Twitter.CreatePollTweet(Text, AnswersArray, 60, Parameters);
    oint twitter CreatePollTweet \
--text "TestTweetdfdb6675-bfb6-4f9c-adb1-ce587dd5c5b9" \
--options "['Option 1','Option 2']" \
--duration 60 \
--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
{
"title": "Too Many Requests",
"detail": "Too Many Requests",
"type": "about:blank",
"status": 429
}