1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-05-31 23:20:02 +02:00
OpenIntegrations/docs/en/md/Twitter/Tweets/Create-custom-tweet.md

62 lines
1.7 KiB
Markdown
Raw Normal View History

2024-10-06 21:51:35 +03:00
---
sidebar_position: 1
---
# 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 | 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) |
2024-10-13 01:21:47 +03:00
| Parameters | --auth | Structure Of String | Authorization data. See GetStandardParameters |
2024-10-06 21:51:35 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from Twitter
<br/>
```bsl title="Code example"
Parameters = GetTwitterAuthData();
Text = "TestTweet" + String(New UUID);
2024-10-12 15:46:40 +03:00
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
2024-10-06 21:51:35 +03:00
ImageArray = New Array();
ImageArray.Add(Image1);
ImageArray.Add(Image2);
2024-10-13 01:21:47 +03:00
MediaArray = OPI_Twitter.UploadAttachmentsArray(ImageArray, "tweet_image", Parameters);
2024-10-06 21:51:35 +03:00
Result = OPI_Twitter.CreateCustomTweet(Text, MediaArray, , , Parameters);
```
```sh title="CLI command example"
2024-10-07 08:57:58 +03:00
oint twitter CreateCustomTweet --text %text% --media %media% --options %options% --dur %dur% --auth %auth%
2024-10-06 21:51:35 +03:00
```
```json title="Result"
{
"data": {
2024-10-09 09:42:00 +03:00
"text": "TestTweetd32c4a6d-1279-4adc-a8e8-c86303e1264b",
"id": "1843892614518501750",
2024-10-06 21:51:35 +03:00
"edit_history_tweet_ids": [
2024-10-09 09:42:00 +03:00
"1843892614518501750"
]
2024-10-06 21:51:35 +03:00
}
}
```