Class: HighLevel::Resources::SocialMediaPosting

Inherits:
Base
  • Object
show all
Defined in:
lib/high_level/resources/social_media_posting.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from HighLevel::Resources::Base

Instance Method Details

#attach_facebook_page_group(location_id:, account_id:, body:, **_opts) ⇒ Object

Attach facebook pages



209
210
211
212
213
214
215
216
# File 'lib/high_level/resources/social_media_posting.rb', line 209

def attach_facebook_page_group(location_id:, account_id:, body:, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/oauth/#{location_id}/facebook/accounts/#{}",
    security: ["bearer"],
    body: body
  )
end

#attach_instagram_page_group(location_id:, account_id:, body:, **_opts) ⇒ Object

Attach Instagram Professional Accounts



261
262
263
264
265
266
267
268
# File 'lib/high_level/resources/social_media_posting.rb', line 261

def attach_instagram_page_group(location_id:, account_id:, body:, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/oauth/#{location_id}/instagram/accounts/#{}",
    security: ["bearer"],
    body: body
  )
end

#attach_linkedin_page_profile(location_id:, account_id:, body:, **_opts) ⇒ Object

Attach linkedin pages and profile



313
314
315
316
317
318
319
320
# File 'lib/high_level/resources/social_media_posting.rb', line 313

def attach_linkedin_page_profile(location_id:, account_id:, body:, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/oauth/#{location_id}/linkedin/accounts/#{}",
    security: ["bearer"],
    body: body
  )
end

#attach_tiktok_profile(location_id:, account_id:, body:, **_opts) ⇒ Object

Attach Tiktok profile



513
514
515
516
517
518
519
520
# File 'lib/high_level/resources/social_media_posting.rb', line 513

def attach_tiktok_profile(location_id:, account_id:, body:, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/oauth/#{location_id}/tiktok/accounts/#{}",
    security: ["bearer"],
    body: body
  )
end

#attach_twitter_profile(location_id:, account_id:, body:, **_opts) ⇒ Object

Attach Twitter profile

<div><div>

<span style= "display: inline-block;
  width: 25px; height: 25px;
  background-color: red;
  color: black;
  font-weight: bold;
  font-size: 24px;
  text-align: center;
  line-height: 20px;
  border: 2px solid black;
  border-radius: 20%;
  margin-right: 10px;">
  !
</span>
<span><strong>As of December 4, 2024, X (formerly Twitter) is no longer supported. We apologise for any inconvenience.</strong></span>

</div></div>



393
394
395
396
397
398
399
400
# File 'lib/high_level/resources/social_media_posting.rb', line 393

def attach_twitter_profile(location_id:, account_id:, body:, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/oauth/#{location_id}/twitter/accounts/#{}",
    security: [],
    body: body
  )
end

#bulk_delete_social_planner_posts(body:, **_opts) ⇒ Object

Bulk Delete Social Planner Posts

Deletes multiple posts based on the provided list of post IDs.

This operation is useful for clearing up large numbers of posts efficiently.

Note:

1.The maximum number of posts that can be deleted in a single request is ‘50’.

2.However, It will only get deleted in Highlevel database but still

it is recommended to be cautious of this operation.


134
135
136
137
138
139
140
141
# File 'lib/high_level/resources/social_media_posting.rb', line 134

def bulk_delete_social_planner_posts(body:, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/#{location_id}/posts/bulk-delete",
    security: [],
    body: body
  )
end

#create_post(location_id:, body:, **_opts) ⇒ Object

Create post

Create posts for all supported platforms. It is possible to create customized posts per channel by using the same platform account IDs in a request and hitting the create post API multiple times with different summaries and account IDs per platform.

The content and media limitations, as well as platform rate limiters corresponding to the respective platforms, are provided in the following reference link:

Link: [Platform Limitations](https://help.leadconnectorhq.com/support/solutions/articles/48001240003-social-planner-image-video-content-and-api-limitations "Social Planner Help")


80
81
82
83
84
85
86
87
# File 'lib/high_level/resources/social_media_posting.rb', line 80

def create_post(location_id:, body:, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/#{location_id}/posts",
    security: ["bearer"],
    body: body
  )
end

#delete_account(location_id:, id:, company_id: nil, user_id: nil, **_opts) ⇒ Object

Delete Account

Delete account and account from group



157
158
159
160
161
162
163
164
# File 'lib/high_level/resources/social_media_posting.rb', line 157

def (location_id:, id:, company_id: nil, user_id: nil, **_opts)
  request(
    method: :delete,
    path: "/social-media-posting/#{location_id}/accounts/#{id}",
    security: ["bearer"],
    params: { "companyId" => company_id, "userId" => user_id }.compact
  )
end

#delete_csv(location_id:, id:, **_opts) ⇒ Object

Delete CSV



453
454
455
456
457
458
459
# File 'lib/high_level/resources/social_media_posting.rb', line 453

def delete_csv(location_id:, id:, **_opts)
  request(
    method: :delete,
    path: "/social-media-posting/#{location_id}/csv/#{id}",
    security: ["bearer"]
  )
end

#delete_csv_post(location_id:, post_id:, csv_id:, **_opts) ⇒ Object

Delete CSV Post



462
463
464
465
466
467
468
# File 'lib/high_level/resources/social_media_posting.rb', line 462

def delete_csv_post(location_id:, post_id:, csv_id:, **_opts)
  request(
    method: :delete,
    path: "/social-media-posting/#{location_id}/csv/#{csv_id}/post/#{post_id}",
    security: ["bearer"]
  )
end

#delete_post(location_id:, id:, **_opts) ⇒ Object

Delete Post



115
116
117
118
119
120
121
# File 'lib/high_level/resources/social_media_posting.rb', line 115

def delete_post(location_id:, id:, **_opts)
  request(
    method: :delete,
    path: "/social-media-posting/#{location_id}/posts/#{id}",
    security: ["bearer"]
  )
end

#edit_post(location_id:, id:, body:, **_opts) ⇒ Object

Edit post

Create posts for all supported platforms. It is possible to create customized posts per channel by using the same platform account IDs in a request and hitting the create post API multiple times with different summaries and account IDs per platform.

The content and media limitations, as well as platform rate limiters corresponding to the respective platforms, are provided in the following reference link:

Link: [Platform Limitations](https://help.leadconnectorhq.com/support/solutions/articles/48001240003-social-planner-image-video-content-and-api-limitations "Social Planner Help")


105
106
107
108
109
110
111
112
# File 'lib/high_level/resources/social_media_posting.rb', line 105

def edit_post(location_id:, id:, body:, **_opts)
  request(
    method: :put,
    path: "/social-media-posting/#{location_id}/posts/#{id}",
    security: ["bearer"],
    body: body
  )
end

#get_account(location_id:, **_opts) ⇒ Object

Get Accounts

Get list of accounts and groups



146
147
148
149
150
151
152
# File 'lib/high_level/resources/social_media_posting.rb', line 146

def (location_id:, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/#{location_id}/accounts",
    security: ["bearer"]
  )
end

#get_categories_id(id:, location_id:, authorization: nil, **_opts) ⇒ Object

Get categories by id



575
576
577
578
579
580
581
582
# File 'lib/high_level/resources/social_media_posting.rb', line 575

def get_categories_id(id:, location_id:, authorization: nil, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/#{location_id}/categories/#{id}",
    security: ["bearer"],
    headers: { "Authorization" => authorization }.compact
  )
end

#get_categories_location_id(location_id:, search_text: nil, limit: nil, skip: nil, **_opts) ⇒ Object

Get categories by location id



565
566
567
568
569
570
571
572
# File 'lib/high_level/resources/social_media_posting.rb', line 565

def get_categories_location_id(location_id:, search_text: nil, limit: nil, skip: nil, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/#{location_id}/categories",
    security: ["bearer"],
    params: { "searchText" => search_text, "limit" => limit, "skip" => skip }.compact
  )
end

#get_csv_post(location_id:, id:, skip: nil, limit: nil, **_opts) ⇒ Object

Get CSV Post



433
434
435
436
437
438
439
440
# File 'lib/high_level/resources/social_media_posting.rb', line 433

def get_csv_post(location_id:, id:, skip: nil, limit: nil, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/#{location_id}/csv/#{id}",
    security: ["bearer"],
    params: { "skip" => skip, "limit" => limit }.compact
  )
end

#get_facebook_page_group(location_id:, account_id:, **_opts) ⇒ Object

Get facebook pages



200
201
202
203
204
205
206
# File 'lib/high_level/resources/social_media_posting.rb', line 200

def get_facebook_page_group(location_id:, account_id:, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/#{location_id}/facebook/accounts/#{}",
    security: ["bearer"]
  )
end

#get_google_locations(location_id:, account_id:, **_opts) ⇒ Object

Get google business locations



43
44
45
46
47
48
49
# File 'lib/high_level/resources/social_media_posting.rb', line 43

def get_google_locations(location_id:, account_id:, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/#{location_id}/google/locations/#{}",
    security: ["bearer"]
  )
end

#get_instagram_page_group(location_id:, account_id:, **_opts) ⇒ Object

Get Instagram Professional Accounts



252
253
254
255
256
257
258
# File 'lib/high_level/resources/social_media_posting.rb', line 252

def get_instagram_page_group(location_id:, account_id:, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/#{location_id}/instagram/accounts/#{}",
    security: ["bearer"]
  )
end

#get_linkedin_page_profile(location_id:, account_id:, **_opts) ⇒ Object

Get Linkedin pages and profile



304
305
306
307
308
309
310
# File 'lib/high_level/resources/social_media_posting.rb', line 304

def get_linkedin_page_profile(location_id:, account_id:, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/#{location_id}/linkedin/accounts/#{}",
    security: ["bearer"]
  )
end

#get_post(location_id:, id:, **_opts) ⇒ Object

Get post



90
91
92
93
94
95
96
# File 'lib/high_level/resources/social_media_posting.rb', line 90

def get_post(location_id:, id:, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/#{location_id}/posts/#{id}",
    security: ["bearer"]
  )
end

#get_posts(location_id:, body:, **_opts) ⇒ Object

Get posts

Get Posts



64
65
66
67
68
69
70
71
# File 'lib/high_level/resources/social_media_posting.rb', line 64

def get_posts(location_id:, body:, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/#{location_id}/posts/list",
    security: ["bearer"],
    body: body
  )
end

#get_social_media_statistics(body:, location_id: nil, **_opts) ⇒ Object

Get Social Media Statistics

Retrieve analytics data for multiple social media accounts. Provides metrics for the last 7 days with comparison to the previous 7 days. Supports filtering by platforms and specific connected accounts.



607
608
609
610
611
612
613
614
615
# File 'lib/high_level/resources/social_media_posting.rb', line 607

def get_social_media_statistics(body:, location_id: nil, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/statistics",
    security: [],
    params: { "locationId" => location_id }.compact,
    body: body
  )
end

#get_tags_by_ids(location_id:, body:, **_opts) ⇒ Object

Get tags by ids



595
596
597
598
599
600
601
602
# File 'lib/high_level/resources/social_media_posting.rb', line 595

def get_tags_by_ids(location_id:, body:, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/#{location_id}/tags/details",
    security: ["bearer"],
    body: body
  )
end

#get_tags_location_id(location_id:, search_text: nil, limit: nil, skip: nil, **_opts) ⇒ Object

Get tags by location id



585
586
587
588
589
590
591
592
# File 'lib/high_level/resources/social_media_posting.rb', line 585

def get_tags_location_id(location_id:, search_text: nil, limit: nil, skip: nil, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/#{location_id}/tags",
    security: ["bearer"],
    params: { "searchText" => search_text, "limit" => limit, "skip" => skip }.compact
  )
end

#get_tiktok_business_profile(location_id:, account_id:, **_opts) ⇒ Object

Get Tiktok Business profile



556
557
558
559
560
561
562
# File 'lib/high_level/resources/social_media_posting.rb', line 556

def get_tiktok_business_profile(location_id:, account_id:, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/#{location_id}/tiktok-business/accounts/#{}",
    security: ["bearer"]
  )
end

#get_tiktok_profile(location_id:, account_id:, **_opts) ⇒ Object

Get Tiktok profile



504
505
506
507
508
509
510
# File 'lib/high_level/resources/social_media_posting.rb', line 504

def get_tiktok_profile(location_id:, account_id:, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/#{location_id}/tiktok/accounts/#{}",
    security: ["bearer"]
  )
end

#get_twitter_profile(location_id:, account_id:, **_opts) ⇒ Object

Get Twitter profile

<div><div>

<span style= "display: inline-block;
  width: 25px; height: 25px;
  background-color: red;
  color: black;
  font-weight: bold;
  font-size: 24px;
  text-align: center;
  line-height: 20px;
  border: 2px solid black;
  border-radius: 20%;
  margin-right: 10px;">
  !
</span>
<span><strong>As of December 4, 2024, X (formerly Twitter) is no longer supported. We apologise for any inconvenience.</strong></span>

</div></div>



367
368
369
370
371
372
373
# File 'lib/high_level/resources/social_media_posting.rb', line 367

def get_twitter_profile(location_id:, account_id:, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/#{location_id}/twitter/accounts/#{}",
    security: []
  )
end

#get_upload_status(location_id:, skip: nil, limit: nil, include_users: nil, user_id: nil, **_opts) ⇒ Object

Get Upload Status



403
404
405
406
407
408
409
410
# File 'lib/high_level/resources/social_media_posting.rb', line 403

def get_upload_status(location_id:, skip: nil, limit: nil, include_users: nil, user_id: nil, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/#{location_id}/csv",
    security: ["bearer"],
    params: { "skip" => skip, "limit" => limit, "includeUsers" => include_users, "userId" => user_id }.compact
  )
end

#set_accounts(location_id:, body:, **_opts) ⇒ Object

Set Accounts



423
424
425
426
427
428
429
430
# File 'lib/high_level/resources/social_media_posting.rb', line 423

def set_accounts(location_id:, body:, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/#{location_id}/set-accounts",
    security: ["bearer"],
    body: body
  )
end

#set_google_locations(location_id:, account_id:, body:, **_opts) ⇒ Object

Set google business locations



52
53
54
55
56
57
58
59
# File 'lib/high_level/resources/social_media_posting.rb', line 52

def set_google_locations(location_id:, account_id:, body:, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/oauth/#{location_id}/google/locations/#{}",
    security: ["bearer"],
    body: body
  )
end

#start_csv_finalize(location_id:, id:, body:, **_opts) ⇒ Object

Start CSV Finalize



443
444
445
446
447
448
449
450
# File 'lib/high_level/resources/social_media_posting.rb', line 443

def start_csv_finalize(location_id:, id:, body:, **_opts)
  request(
    method: :patch,
    path: "/social-media-posting/#{location_id}/csv/#{id}",
    security: ["bearer"],
    body: body
  )
end

#start_facebook_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts) ⇒ Object

Starts OAuth For Facebook Account

Open the API in a window with appropriate params and headers instead of using the Curl. User is navigated to Facebook login OAuth screen. On successful login, listen on window object for message where event listener returns data in its callback function.

### Sample code to listen to event data:
  window.addEventListener('message',
    function(e) {
      if (e.data && e.data.page === 'social_media_posting') {
      const { actionType, page, platform, placement, accountId, reconnectAccounts } = e.data
      }
    },
  false)
### Event Data Response:
  {
    actionType: string,            Ex: "close"
    page: string,                  Ex: "social-media-posting"
    platform: string,              Ex: "facebook"
    placement: string,             Ex: "placement"
    accountId: string,             Ex: "658a9b6833b91e0ecb8f3958"
    reconnectAccounts: string[]]   Ex: ["658a9b6833b91e0ecb834acd", "efd2daa9b6833b91e0ecb8f3511"]
  }
### The accountId retrieved from above data can be used to fetch Facebook account details using below API -
API: '/social-media-posting/oauth/facebook/accounts/:accountId'

Method: GET


190
191
192
193
194
195
196
197
# File 'lib/high_level/resources/social_media_posting.rb', line 190

def start_facebook_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/facebook/start",
    security: ["bearer"],
    params: { "locationId" => location_id, "userId" => user_id, "page" => page, "reconnect" => reconnect }.compact
  )
end

#start_google_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts) ⇒ Object

Starts OAuth For Google Account

Open the API in a window with appropriate params and headers instead of using the Curl. User is navigated to Google login OAuth screen. On successful login, listen on window object for message where event listener returns data in its callback function.

### Sample code to listen to event data:
  window.addEventListener('message',
    function(e) {
      if (e.data && e.data.page === 'social_media_posting') {
      const { actionType, page, platform, placement, accountId, reconnectAccounts } = e.data
      }
    },
  false)
### Event Data Response:
  {
    actionType: string,            Ex: "close"
    page: string,                  Ex: "social-media-posting"
    platform: string,              Ex: "google"
    placement: string,             Ex: "placement"
    accountId: string,             Ex: "658a9b6833b91e0ecb8f3958"
    reconnectAccounts: string[]]   Ex: ["658a9b6833b91e0ecb834acd", "efd2daa9b6833b91e0ecb8f3511"]
  }
### The accountId retrieved from above data can be used to fetch Google account details using below API -
API: '/social-media-posting/oauth/google/accounts/:accountId'

Method: GET


33
34
35
36
37
38
39
40
# File 'lib/high_level/resources/social_media_posting.rb', line 33

def start_google_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/google/start",
    security: ["bearer"],
    params: { "locationId" => location_id, "userId" => user_id, "page" => page, "reconnect" => reconnect }.compact
  )
end

#start_instagram_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts) ⇒ Object

Starts OAuth For Instagram Account

Open the API in a window with appropriate params and headers instead of using the Curl. User is navigated to Instagram login OAuth screen. On successful login, listen on window object for message where event listener returns data in its callback function.

### Sample code to listen to event data:
  window.addEventListener('message',
    function(e) {
      if (e.data && e.data.page === 'social_media_posting') {
      const { actionType, page, platform, placement, accountId, reconnectAccounts } = e.data
      }
    },
  false)
### Event Data Response:
  {
    actionType: string,            Ex: "close"
    page: string,                  Ex: "social-media-posting"
    platform: string,              Ex: "instagram"
    placement: string,             Ex: "placement"
    accountId: string,             Ex: "658a9b6833b91e0ecb8f3958"
    reconnectAccounts: string[]]   Ex: ["658a9b6833b91e0ecb834acd", "efd2daa9b6833b91e0ecb8f3511"]
  }
### The accountId retrieved from above data can be used to fetch Instagram account details using below API -
API: '/social-media-posting/oauth/instagram/accounts/:accountId'

Method: GET


242
243
244
245
246
247
248
249
# File 'lib/high_level/resources/social_media_posting.rb', line 242

def start_instagram_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/instagram/start",
    security: ["bearer"],
    params: { "locationId" => location_id, "userId" => user_id, "page" => page, "reconnect" => reconnect }.compact
  )
end

#start_linkedin_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts) ⇒ Object

Starts OAuth For LinkedIn Account

Open the API in a window with appropriate params and headers instead of using the Curl. User is navigated to LinkedIn login OAuth screen. On successful login, listen on window object for message where event listener returns data in its callback function.

### Sample code to listen to event data:
  window.addEventListener('message',
    function(e) {
      if (e.data && e.data.page === 'social_media_posting') {
      const { actionType, page, platform, placement, accountId, reconnectAccounts } = e.data
      }
    },
  false)
### Event Data Response:
  {
    actionType: string,            Ex: "close"
    page: string,                  Ex: "social-media-posting"
    platform: string,              Ex: "linkedin"
    placement: string,             Ex: "placement"
    accountId: string,             Ex: "658a9b6833b91e0ecb8f3958"
    reconnectAccounts: string[]]   Ex: ["658a9b6833b91e0ecb834acd", "efd2daa9b6833b91e0ecb8f3511"]
  }
### The accountId retrieved from above data can be used to fetch LinkedIn account details using below API -
API: '/social-media-posting/oauth/linkedin/accounts/:accountId'

Method: GET


294
295
296
297
298
299
300
301
# File 'lib/high_level/resources/social_media_posting.rb', line 294

def start_linkedin_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/linkedin/start",
    security: ["bearer"],
    params: { "locationId" => location_id, "userId" => user_id, "page" => page, "reconnect" => reconnect }.compact
  )
end

#start_tiktok_business_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts) ⇒ Object

Starts OAuth For Tiktok Business Account

Open the API in a window with appropriate params and headers instead of using the Curl. User is navigated to Tiktok-Business login OAuth screen. On successful login, listen on window object for message where event listener returns data in its callback function.

### Sample code to listen to event data:
  window.addEventListener('message',
    function(e) {
      if (e.data && e.data.page === 'social_media_posting') {
      const { actionType, page, platform, placement, accountId, reconnectAccounts } = e.data
      }
    },
  false)
### Event Data Response:
  {
    actionType: string,            Ex: "close"
    page: string,                  Ex: "social-media-posting"
    platform: string,              Ex: "tiktok-business"
    placement: string,             Ex: "placement"
    accountId: string,             Ex: "658a9b6833b91e0ecb8f3958"
    reconnectAccounts: string[]]   Ex: ["658a9b6833b91e0ecb834acd", "efd2daa9b6833b91e0ecb8f3511"]
  }
### The accountId retrieved from above data can be used to fetch Tiktok-Business account details using below API -
API: '/social-media-posting/oauth/tiktok-business/accounts/:accountId'

Method: GET


546
547
548
549
550
551
552
553
# File 'lib/high_level/resources/social_media_posting.rb', line 546

def start_tiktok_business_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/tiktok-business/start",
    security: ["bearer"],
    params: { "locationId" => location_id, "userId" => user_id, "page" => page, "reconnect" => reconnect }.compact
  )
end

#start_tiktok_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts) ⇒ Object

Starts OAuth For Tiktok Account

Open the API in a window with appropriate params and headers instead of using the Curl. User is navigated to Tiktok login OAuth screen. On successful login, listen on window object for message where event listener returns data in its callback function.

### Sample code to listen to event data:
  window.addEventListener('message',
    function(e) {
      if (e.data && e.data.page === 'social_media_posting') {
      const { actionType, page, platform, placement, accountId, reconnectAccounts } = e.data
      }
    },
  false)
### Event Data Response:
  {
    actionType: string,            Ex: "close"
    page: string,                  Ex: "social-media-posting"
    platform: string,              Ex: "tiktok"
    placement: string,             Ex: "placement"
    accountId: string,             Ex: "658a9b6833b91e0ecb8f3958"
    reconnectAccounts: string[]]   Ex: ["658a9b6833b91e0ecb834acd", "efd2daa9b6833b91e0ecb8f3511"]
  }
### The accountId retrieved from above data can be used to fetch Tiktok account details using below API -
API: '/social-media-posting/oauth/tiktok/accounts/:accountId'

Method: GET


494
495
496
497
498
499
500
501
# File 'lib/high_level/resources/social_media_posting.rb', line 494

def start_tiktok_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/tiktok/start",
    security: ["bearer"],
    params: { "locationId" => location_id, "userId" => user_id, "page" => page, "reconnect" => reconnect }.compact
  )
end

#start_twitter_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts) ⇒ Object

Starts OAuth For Twitter Account

<div><div>

<span style= "display: inline-block;
  width: 25px; height: 25px;
  background-color: red;
  color: black;
  font-weight: bold;
  font-size: 24px;
  text-align: center;
  line-height: 20px;
  border: 2px solid black;
  border-radius: 20%;
  margin-right: 10px;">
  !
</span>
<span><strong>As of December 4, 2024, X (formerly Twitter) is no longer supported. We apologise for any inconvenience.</strong></span>

</div></div>



340
341
342
343
344
345
346
347
# File 'lib/high_level/resources/social_media_posting.rb', line 340

def start_twitter_oauth(location_id: nil, user_id: nil, page: nil, reconnect: nil, **_opts)
  request(
    method: :get,
    path: "/social-media-posting/oauth/twitter/start",
    security: ["bearer"],
    params: { "locationId" => location_id, "userId" => user_id, "page" => page, "reconnect" => reconnect }.compact
  )
end

#upload_csv(location_id:, body:, **_opts) ⇒ Object

Upload CSV



413
414
415
416
417
418
419
420
# File 'lib/high_level/resources/social_media_posting.rb', line 413

def upload_csv(location_id:, body:, **_opts)
  request(
    method: :post,
    path: "/social-media-posting/#{location_id}/csv",
    security: ["bearer"],
    body: body
  )
end