mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-05-27 23:07:37 +02:00
87 lines
3.1 KiB
Plaintext
87 lines
3.1 KiB
Plaintext
---
|
|
sidebar_position: 1
|
|
---
|
|
|
|
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 | ✖ | Tweet text |
|
|
| MediaArray | --media | Array of String, BinaryData | ✖ | Array of binary data or file paths |
|
|
| PollOptionsArray | --options | Array of String | ✖ | Array of poll options, if necessary |
|
|
| PollDuration | --dur | String, Number | ✖ | Poll duration if necessary (poll without duration is not created) |
|
|
| Parameters | --auth | Structure Of String | ✖ | Authorization data. See GetStandardParameters |
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Twitter
|
|
|
|
<br/>
|
|
|
|
:::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://api.athenaeum.digital/test_data/picture.jpg"; // URL, Binary Data or Path to file
|
|
Image2 = "https://api.athenaeum.digital/test_data/picture2.jpg"; // URL, Binary Data or Path to file
|
|
|
|
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 "TestTweet2dfb146c-64d5-4ad9-a0fc-3fb4ed9c8d1f" \
|
|
--media "['1864706502079938567','1864706529502412800']" \
|
|
--auth "{'redirect_uri':'https://api.athenaeum.digital/opi/hs/twitter','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 "TestTweet2dfb146c-64d5-4ad9-a0fc-3fb4ed9c8d1f" ^
|
|
--media "['1864706502079938567','1864706529502412800']" ^
|
|
--auth "{'redirect_uri':'https://api.athenaeum.digital/opi/hs/twitter','client_id':'***','client_secret':'***','access_token':'***','refresh_token':'***','oauth_token':'***','oauth_token_secret':'***','oauth_consumer_key':'***','oauth_consumer_secret':'***'}"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"data": {
|
|
"text": "TestTweetd32c4a6d-1279-4adc-a8e8-c86303e1264b",
|
|
"id": "1843892614518501750",
|
|
"edit_history_tweet_ids": [
|
|
"1843892614518501750"
|
|
]
|
|
}
|
|
}
|
|
```
|