---
sidebar_position: 1
description: Create custom tweet and other functions to work with Twitter in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Twitter]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Create custom tweet
 Creates a tweet with custom content



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

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Text | --text | String | &#x2716; | Tweet text |
  | MediaArray | --media | Array of String, BinaryData | &#x2716; | Array of binary data or file paths |
  | PollOptionsArray | --options | Array of String | &#x2716; | Array of poll options, if necessary |
  | PollDuration | --dur | String, Number | &#x2716; | Poll duration if necessary (poll without duration is not created) |
  | Parameters | --auth | Structure Of String | &#x2716; | Authorization 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
:::
<br/>


```bsl title="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);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint twitter CreateCustomTweet \
             --text "TestTweet8d77cbcf-d726-4b2f-ac0f-ff577cee7b0e" \
             --media "['1998822556820807680','1998822569118519297']" \
             --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':'***'}"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint twitter CreateCustomTweet ^
             --text "TestTweet8d77cbcf-d726-4b2f-ac0f-ff577cee7b0e" ^
             --media "['1998822556820807680','1998822569118519297']" ^
             --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':'***'}"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "title": "Too Many Requests",
 "detail": "Too Many Requests",
 "type": "about:blank",
 "status": 429
}
```
