@pipedream/hootsuite 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/actions/create-media-upload-job/create-media-upload-job.mjs +82 -0
- package/actions/get-media-upload-status/get-media-upload-status.mjs +31 -0
- package/actions/schedule-message/schedule-message.mjs +368 -0
- package/common/constants.mjs +2666 -0
- package/common/utils.mjs +24 -0
- package/hootsuite.app.mjs +52 -15
- package/package.json +2 -2
- package/sources/new-post-created/new-post-created.mjs +2 -8
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
The Hootsuite API offers a variety of endpoints to automate social media management tasks such as scheduling posts, managing social content, and analyzing social media performance. By leveraging Pipedream, you can create serverless workflows to interact with the Hootsuite API; you can schedule posts at optimal times, aggregate metrics for reporting, or even respond to social media activity in real-time. Pipedream's platform allows the seamless integration of the Hootsuite API with 3,000+ other apps to streamline social media workflows, monitor brand presence, and engage with audiences effectively.
|
|
4
|
+
|
|
5
|
+
# Example Use Cases
|
|
6
|
+
|
|
7
|
+
- **Automated Social Media Posting**: Schedule and post content to multiple social media platforms. Use Pipedream's cron jobs to trigger posts at specific times, ensuring your content hits the right audience at the right time without manual intervention.
|
|
8
|
+
|
|
9
|
+
- **Social Media Analytics Dashboard**: Pull analytics data from Hootsuite and send it to a Google Sheets spreadsheet using Pipedream. Automate weekly or monthly reports, giving you insights into engagement rates, follower growth, and content performance without manually compiling data.
|
|
10
|
+
|
|
11
|
+
- **Real-Time Social Media Monitoring and Response**: Set up a workflow that listens for specific keywords or brand mentions on social media via Hootsuite and automatically responds or notifies your team in Slack. This encourages timely engagement and helps maintain brand reputation by staying on top of social interactions.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { getFileStreamAndMetadata } from "@pipedream/platform";
|
|
2
|
+
import hootsuite from "../../hootsuite.app.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "hootsuite-create-media-upload-job",
|
|
6
|
+
name: "Create Media Upload Job",
|
|
7
|
+
description: "Creates a new Media Upload Job on your Hootsuite account. [See the documentation](https://apidocs.hootsuite.com/docs/api/index.html#operation/createMedia)",
|
|
8
|
+
version: "0.0.2",
|
|
9
|
+
annotations: {
|
|
10
|
+
destructiveHint: false,
|
|
11
|
+
openWorldHint: true,
|
|
12
|
+
readOnlyHint: false,
|
|
13
|
+
},
|
|
14
|
+
type: "action",
|
|
15
|
+
props: {
|
|
16
|
+
hootsuite,
|
|
17
|
+
file: {
|
|
18
|
+
type: "string",
|
|
19
|
+
label: "File Path or URL",
|
|
20
|
+
description: "The path or URL to the image file.",
|
|
21
|
+
},
|
|
22
|
+
syncDir: {
|
|
23
|
+
type: "dir",
|
|
24
|
+
accessMode: "read",
|
|
25
|
+
sync: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
initializeUpload(opts = {}) {
|
|
30
|
+
return this.hootsuite._makeRequest({
|
|
31
|
+
method: "POST",
|
|
32
|
+
path: "/media",
|
|
33
|
+
...opts,
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
streamToBuffer(stream) {
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
const chunks = [];
|
|
39
|
+
stream.on("data", (chunk) => chunks.push(chunk));
|
|
40
|
+
stream.on("end", () => resolve(Buffer.concat(chunks)));
|
|
41
|
+
stream.on("error", reject);
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
uploadImage(url, fileBinary, headers) {
|
|
45
|
+
return this.hootsuite._makeRequest({
|
|
46
|
+
url,
|
|
47
|
+
method: "PUT",
|
|
48
|
+
maxBodyLength: Infinity,
|
|
49
|
+
data: Buffer.from(fileBinary, "binary"),
|
|
50
|
+
noHeaders: true,
|
|
51
|
+
headers,
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
async run({ $ }) {
|
|
56
|
+
const {
|
|
57
|
+
stream, metadata,
|
|
58
|
+
} = await getFileStreamAndMetadata(this.file);
|
|
59
|
+
|
|
60
|
+
const {
|
|
61
|
+
data: {
|
|
62
|
+
uploadUrl, id,
|
|
63
|
+
},
|
|
64
|
+
} = await this.initializeUpload({
|
|
65
|
+
data: {
|
|
66
|
+
sizeBytes: metadata.size,
|
|
67
|
+
mimeType: metadata.contentType,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const fileBinary = await this.streamToBuffer(stream);
|
|
72
|
+
|
|
73
|
+
await this.uploadImage(uploadUrl, fileBinary, {
|
|
74
|
+
"Content-Type": metadata.contentType,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
$.export("$summary", `Successfully created media upload job with ID: ${id}`);
|
|
78
|
+
return {
|
|
79
|
+
fileId: id,
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import hootsuite from "../../hootsuite.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "hootsuite-get-media-upload-status",
|
|
5
|
+
name: "Get Media Upload Status",
|
|
6
|
+
description: "Gets the status of a Media Upload Job on your Hootsuite account. [See the documentation](https://apidocs.hootsuite.com/docs/api/index.html#operation/getMedia)",
|
|
7
|
+
version: "0.0.2",
|
|
8
|
+
annotations: {
|
|
9
|
+
destructiveHint: false,
|
|
10
|
+
openWorldHint: true,
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
},
|
|
13
|
+
type: "action",
|
|
14
|
+
props: {
|
|
15
|
+
hootsuite,
|
|
16
|
+
fileId: {
|
|
17
|
+
type: "string",
|
|
18
|
+
label: "File ID",
|
|
19
|
+
description: "The ID of the file to get the status of.",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
async run({ $ }) {
|
|
23
|
+
const response = await this.hootsuite.getMediaUploadStatus({
|
|
24
|
+
$,
|
|
25
|
+
fileId: this.fileId,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
$.export("$summary", `Successfully got media upload status for file ID: ${this.fileId}`);
|
|
29
|
+
return response;
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPANY_SIZE_OPTIONS,
|
|
3
|
+
GEOGRAPHY_OPTIONS,
|
|
4
|
+
INDUSTRY_OPTIONS,
|
|
5
|
+
JOB_FUNCTION_OPTIONS,
|
|
6
|
+
SENIORITY_OPTIONS,
|
|
7
|
+
STAFF_COUNT_RANGE_OPTIONS,
|
|
8
|
+
} from "../../common/constants.mjs";
|
|
9
|
+
import { parseObject } from "../../common/utils.mjs";
|
|
10
|
+
import hootsuite from "../../hootsuite.app.mjs";
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
key: "hootsuite-schedule-message",
|
|
14
|
+
name: "Schedule Message",
|
|
15
|
+
description: "Schedules a message on your Hootsuite account. [See the documentation](https://apidocs.hootsuite.com/docs/api/index.html#operation/scheduleMessage)",
|
|
16
|
+
version: "0.0.2",
|
|
17
|
+
annotations: {
|
|
18
|
+
destructiveHint: false,
|
|
19
|
+
openWorldHint: true,
|
|
20
|
+
readOnlyHint: false,
|
|
21
|
+
},
|
|
22
|
+
type: "action",
|
|
23
|
+
props: {
|
|
24
|
+
hootsuite,
|
|
25
|
+
text: {
|
|
26
|
+
type: "string",
|
|
27
|
+
label: "Text",
|
|
28
|
+
description: "The message text to publish.",
|
|
29
|
+
},
|
|
30
|
+
socialProfileIds: {
|
|
31
|
+
propDefinition: [
|
|
32
|
+
hootsuite,
|
|
33
|
+
"socialProfileIds",
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
scheduledSendTime: {
|
|
37
|
+
type: "string",
|
|
38
|
+
label: "Scheduled Send Time",
|
|
39
|
+
description: "The time the message is scheduled to be sent in UTC time, [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format. Missing or different timezones will not be accepted, to ensure there is no ambiguity about scheduled time. Dates must end with 'Z' to be accepted.",
|
|
40
|
+
optional: true,
|
|
41
|
+
},
|
|
42
|
+
webhookUrls: {
|
|
43
|
+
type: "string[]",
|
|
44
|
+
label: "Webhook URLs",
|
|
45
|
+
description: "The webhook URL(s) to call to when the message's state changes.",
|
|
46
|
+
optional: true,
|
|
47
|
+
},
|
|
48
|
+
tags: {
|
|
49
|
+
type: "string[]",
|
|
50
|
+
label: "Tags",
|
|
51
|
+
description: "The Hootsuite message tags to apply to the message. To set tags the social profile must belong to an organization. Tags are case sensitive. Limited permission members can only use the existing tags for organization and cannot create new ones. See more about message tags at the Hootsuite Help Center. Not supported by Pinterest.",
|
|
52
|
+
optional: true,
|
|
53
|
+
},
|
|
54
|
+
targetingFacebookPageAgeMin: {
|
|
55
|
+
type: "string",
|
|
56
|
+
label: "Targeting Facebook Page - Age Min",
|
|
57
|
+
description: "Minimum age to target the message at.",
|
|
58
|
+
options: [
|
|
59
|
+
"13",
|
|
60
|
+
"17",
|
|
61
|
+
"18",
|
|
62
|
+
"19",
|
|
63
|
+
"21",
|
|
64
|
+
],
|
|
65
|
+
optional: true,
|
|
66
|
+
},
|
|
67
|
+
targetingFacebookPageEducation: {
|
|
68
|
+
type: "string[]",
|
|
69
|
+
label: "Targeting Facebook Page - Education",
|
|
70
|
+
description: "The education level of the Facebook page to target.",
|
|
71
|
+
options: [
|
|
72
|
+
"highSchool",
|
|
73
|
+
"college",
|
|
74
|
+
"collegeGrad",
|
|
75
|
+
],
|
|
76
|
+
optional: true,
|
|
77
|
+
},
|
|
78
|
+
targetingFacebookPageInterestIn: {
|
|
79
|
+
type: "string[]",
|
|
80
|
+
label: "Targeting Facebook Page - Interests",
|
|
81
|
+
description: "Interested in preferences to target the message at.",
|
|
82
|
+
options: [
|
|
83
|
+
"male",
|
|
84
|
+
"female",
|
|
85
|
+
],
|
|
86
|
+
optional: true,
|
|
87
|
+
},
|
|
88
|
+
targetingFacebookPageRelationshipStatus: {
|
|
89
|
+
type: "string[]",
|
|
90
|
+
label: "Targeting Facebook Page - Relationship Status",
|
|
91
|
+
description: "Relationship status to target the message at.",
|
|
92
|
+
options: [
|
|
93
|
+
"single",
|
|
94
|
+
"relationship",
|
|
95
|
+
"married",
|
|
96
|
+
"engaged",
|
|
97
|
+
],
|
|
98
|
+
optional: true,
|
|
99
|
+
},
|
|
100
|
+
targetingFacebookPageCountry: {
|
|
101
|
+
type: "string[]",
|
|
102
|
+
label: "Targeting Facebook Page - Country",
|
|
103
|
+
description: "Country to target the message at. 2-digit ISO 3166 format code as provided by Facebook. **Format: [{\"k\": \"Canada\", \"v\": \"CA\"}]** [See the documentation](https://apidocs.hootsuite.com/docs/api/index.html#operation/scheduleMessage) for more information.",
|
|
104
|
+
optional: true,
|
|
105
|
+
},
|
|
106
|
+
targetingFacebookPageRegions: {
|
|
107
|
+
type: "string[]",
|
|
108
|
+
label: "Targeting Facebook Page - Regions",
|
|
109
|
+
description: "Region to target the message at. Note that regions can only be specified when there is exactly one country targeted. Limit 200. **Format: [{\"k\": \"British Columbia\", \"v\": \"2\"}]** [See the documentation](https://apidocs.hootsuite.com/docs/api/index.html#operation/scheduleMessage) for more information.",
|
|
110
|
+
optional: true,
|
|
111
|
+
},
|
|
112
|
+
targetingFacebookPageCities: {
|
|
113
|
+
type: "string[]",
|
|
114
|
+
label: "Targeting Facebook Page - Cities",
|
|
115
|
+
description: "City to target the message at. Note that cities can only be specified when there is exactly one country targeted. Limit 250. **Format: [{\"k\": \"Burnaby, BC\", \"v\": \"292466\"}]** [See the documentation](https://apidocs.hootsuite.com/docs/api/index.html#operation/scheduleMessage) for more information.",
|
|
116
|
+
optional: true,
|
|
117
|
+
},
|
|
118
|
+
targetingFacebookPageZips: {
|
|
119
|
+
type: "string[]",
|
|
120
|
+
label: "Targeting Facebook Page - Zip",
|
|
121
|
+
description: "Zip/Postal Code to target the message at. Limit 50,000. **Format: [{\"k\": \"K1S\", \"v\": \"CA:K1S\"}]** [See the documentation](https://apidocs.hootsuite.com/docs/api/index.html#operation/scheduleMessage) for more information.",
|
|
122
|
+
optional: true,
|
|
123
|
+
},
|
|
124
|
+
targetingLinkedInCompanySize: {
|
|
125
|
+
type: "string[]",
|
|
126
|
+
label: "Targeting LinkedIn Company - Size",
|
|
127
|
+
description: "Company size to target the message at.",
|
|
128
|
+
options: COMPANY_SIZE_OPTIONS,
|
|
129
|
+
optional: true,
|
|
130
|
+
},
|
|
131
|
+
targetingLinkedInCompanyGeography: {
|
|
132
|
+
type: "string[]",
|
|
133
|
+
label: "Targeting LinkedIn Company - Geography",
|
|
134
|
+
description: "Geography to target the message at.",
|
|
135
|
+
options: GEOGRAPHY_OPTIONS,
|
|
136
|
+
optional: true,
|
|
137
|
+
},
|
|
138
|
+
targetingLinkedInCompanyIndustry: {
|
|
139
|
+
type: "string[]",
|
|
140
|
+
label: "Targeting LinkedIn Company - Industry",
|
|
141
|
+
description: "Industry to target the message at.",
|
|
142
|
+
options: INDUSTRY_OPTIONS,
|
|
143
|
+
optional: true,
|
|
144
|
+
},
|
|
145
|
+
targetingLinkedInCompanyJobFunction: {
|
|
146
|
+
type: "string[]",
|
|
147
|
+
label: "Targeting LinkedIn Company - Job Function",
|
|
148
|
+
description: "Job function to target the message at.",
|
|
149
|
+
options: JOB_FUNCTION_OPTIONS,
|
|
150
|
+
optional: true,
|
|
151
|
+
},
|
|
152
|
+
targetingLinkedInCompanySeniority: {
|
|
153
|
+
type: "string[]",
|
|
154
|
+
label: "Targeting LinkedIn Company - Seniority",
|
|
155
|
+
description: "Seniority to target the message at.",
|
|
156
|
+
options: SENIORITY_OPTIONS,
|
|
157
|
+
optional: true,
|
|
158
|
+
},
|
|
159
|
+
targetingLinkedInV2CompanyLocations: {
|
|
160
|
+
type: "string[]",
|
|
161
|
+
label: "Targeting LinkedIn V2 Company - Locations",
|
|
162
|
+
description: "Locations to target the message at, expected format of `urn:li:geo:{CODE}`. [Geo Locations reference](https://learn.microsoft.com/en-us/linkedin/shared/references/v2/standardized-data/locations/geo), [Geo Typeahead Locations reference](https://learn.microsoft.com/en-us/linkedin/shared/references/v2/standardized-data/locations/geo-typeahead?tabs=http)",
|
|
163
|
+
optional: true,
|
|
164
|
+
},
|
|
165
|
+
targetingLinkedInV2CompanyStaffCountRange: {
|
|
166
|
+
type: "string[]",
|
|
167
|
+
label: "Targeting LinkedIn V2 Company - Staff Count Range",
|
|
168
|
+
description: "Staff count to target the message at, expected format of `SIZE_{VALUES}`. [Staff count codes reference](https://learn.microsoft.com/en-us/linkedin/shared/references/reference-tables/company-size-codes)",
|
|
169
|
+
options: STAFF_COUNT_RANGE_OPTIONS,
|
|
170
|
+
optional: true,
|
|
171
|
+
},
|
|
172
|
+
targetingLinkedInV2CompanySeniorities: {
|
|
173
|
+
type: "string[]",
|
|
174
|
+
label: "Targeting LinkedIn V2 Company - Seniorities",
|
|
175
|
+
description: "Seniorities to target the message at, expected format of `urn:li:seniority:{CODE}`. [Seniorities codes reference](https://learn.microsoft.com/en-us/linkedin/shared/references/reference-tables/seniority-codes)",
|
|
176
|
+
optional: true,
|
|
177
|
+
},
|
|
178
|
+
targetingLinkedInV2CompanyIndustries: {
|
|
179
|
+
type: "string[]",
|
|
180
|
+
label: "Targeting LinkedIn V2 Company - Industries",
|
|
181
|
+
description: "Industries to target the message at, expected format of `urn:li:industry:{CODE}`. [Industries codes reference](https://learn.microsoft.com/en-us/linkedin/shared/references/reference-tables/industry-codes-v2)",
|
|
182
|
+
optional: true,
|
|
183
|
+
},
|
|
184
|
+
targetingLinkedInV2CompanyInterfaceLocations: {
|
|
185
|
+
type: "string[]",
|
|
186
|
+
label: "Targeting LinkedIn V2 Company - Interface Locations",
|
|
187
|
+
description: "Languages to target the message at, expected format of `{\"country\":\"COUNTRY\",\"language\":\"language\"}`. [Language codes reference](https://learn.microsoft.com/en-us/linkedin/shared/references/reference-tables/language-codes) Languages can be interpreted as this format: language_COUNTRY, replace in request as necessary.",
|
|
188
|
+
optional: true,
|
|
189
|
+
},
|
|
190
|
+
privacyFacebookVisibility: {
|
|
191
|
+
type: "string",
|
|
192
|
+
label: "Privacy Facebook Visibility",
|
|
193
|
+
description: "Facebook visibility rule.",
|
|
194
|
+
options: [
|
|
195
|
+
"everyone",
|
|
196
|
+
"friends",
|
|
197
|
+
"friendsOfFriends",
|
|
198
|
+
],
|
|
199
|
+
optional: true,
|
|
200
|
+
},
|
|
201
|
+
privacyLinkedInVisibility: {
|
|
202
|
+
type: "string",
|
|
203
|
+
label: "Privacy LinkedIn Visibility",
|
|
204
|
+
description: "LinkedIn visibility rule.",
|
|
205
|
+
options: [
|
|
206
|
+
"anyone",
|
|
207
|
+
"connectionsOnly",
|
|
208
|
+
],
|
|
209
|
+
optional: true,
|
|
210
|
+
},
|
|
211
|
+
latitude: {
|
|
212
|
+
type: "string",
|
|
213
|
+
label: "Latitude",
|
|
214
|
+
description: "The latitude in decimal degrees. Must be between -90 to 90.",
|
|
215
|
+
optional: true,
|
|
216
|
+
},
|
|
217
|
+
longitude: {
|
|
218
|
+
type: "string",
|
|
219
|
+
label: "Longitude",
|
|
220
|
+
description: "The longitude in decimal degrees. Must be between -180 to 180.",
|
|
221
|
+
optional: true,
|
|
222
|
+
},
|
|
223
|
+
emailNotification: {
|
|
224
|
+
type: "boolean",
|
|
225
|
+
label: "Email Notification",
|
|
226
|
+
description: "A flag to determine whether email notifications are sent when the message is published.",
|
|
227
|
+
optional: true,
|
|
228
|
+
},
|
|
229
|
+
mediaUrls: {
|
|
230
|
+
type: "string[]",
|
|
231
|
+
label: "Media URLs",
|
|
232
|
+
description: "The ow.ly media to attach to the message",
|
|
233
|
+
optional: true,
|
|
234
|
+
},
|
|
235
|
+
media: {
|
|
236
|
+
type: "string[]",
|
|
237
|
+
label: "Media",
|
|
238
|
+
description: "The media id(s) returned at `Create Media Upload Job` action to attach to the message",
|
|
239
|
+
optional: true,
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
async run({ $ }) {
|
|
243
|
+
const facebookPage = {};
|
|
244
|
+
|
|
245
|
+
if (this.targetingFacebookPageAgeMin) {
|
|
246
|
+
facebookPage.ageMin = parseInt(this.targetingFacebookPageAgeMin);
|
|
247
|
+
}
|
|
248
|
+
if (this.targetingFacebookPageEducation) {
|
|
249
|
+
facebookPage.education = parseObject(this.targetingFacebookPageEducation);
|
|
250
|
+
}
|
|
251
|
+
if (this.targetingFacebookPageInterestIn) {
|
|
252
|
+
facebookPage.interestIn = parseObject(this.targetingFacebookPageInterestIn);
|
|
253
|
+
}
|
|
254
|
+
if (this.targetingFacebookPageRelationshipStatus) {
|
|
255
|
+
facebookPage.relationshipStatus = parseObject(this.targetingFacebookPageRelationshipStatus);
|
|
256
|
+
}
|
|
257
|
+
if (this.targetingFacebookPageCountry) {
|
|
258
|
+
facebookPage.countries = parseObject(this.targetingFacebookPageCountry);
|
|
259
|
+
}
|
|
260
|
+
if (this.targetingFacebookPageRegions) {
|
|
261
|
+
facebookPage.regions = parseObject(this.targetingFacebookPageRegions);
|
|
262
|
+
}
|
|
263
|
+
if (this.targetingFacebookPageCities) {
|
|
264
|
+
facebookPage.cities = parseObject(this.targetingFacebookPageCities);
|
|
265
|
+
}
|
|
266
|
+
if (this.targetingFacebookPageZips) {
|
|
267
|
+
facebookPage.zips = parseObject(this.targetingFacebookPageZips);
|
|
268
|
+
}
|
|
269
|
+
const linkedInCompany = {};
|
|
270
|
+
if (this.targetingLinkedInCompanySize) {
|
|
271
|
+
linkedInCompany.companySize = parseObject(this.targetingLinkedInCompanySize);
|
|
272
|
+
}
|
|
273
|
+
if (this.targetingLinkedInCompanyGeography) {
|
|
274
|
+
linkedInCompany.geography = parseObject(this.targetingLinkedInCompanyGeography);
|
|
275
|
+
}
|
|
276
|
+
if (this.targetingLinkedInCompanyIndustry) {
|
|
277
|
+
linkedInCompany.industry =
|
|
278
|
+
parseObject(this.targetingLinkedInCompanyIndustry)?.map((item) => String(item));
|
|
279
|
+
}
|
|
280
|
+
if (this.targetingLinkedInCompanyJobFunction) {
|
|
281
|
+
linkedInCompany.jobFunction = parseObject(this.targetingLinkedInCompanyJobFunction);
|
|
282
|
+
}
|
|
283
|
+
if (this.targetingLinkedInCompanySeniority) {
|
|
284
|
+
linkedInCompany.seniority = parseObject(this.targetingLinkedInCompanySeniority);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const linkedInV2Company = {};
|
|
288
|
+
if (this.targetingLinkedInV2CompanyLocations) {
|
|
289
|
+
linkedInV2Company.locations = parseObject(this.targetingLinkedInV2CompanyLocations);
|
|
290
|
+
}
|
|
291
|
+
if (this.targetingLinkedInV2CompanyStaffCountRange) {
|
|
292
|
+
linkedInV2Company.staffCountRange =
|
|
293
|
+
parseObject(this.targetingLinkedInV2CompanyStaffCountRange);
|
|
294
|
+
}
|
|
295
|
+
if (this.targetingLinkedInV2CompanySeniorities) {
|
|
296
|
+
linkedInV2Company.seniorities = parseObject(this.targetingLinkedInV2CompanySeniorities);
|
|
297
|
+
}
|
|
298
|
+
if (this.targetingLinkedInV2CompanyIndustries) {
|
|
299
|
+
linkedInV2Company.industries = parseObject(this.targetingLinkedInV2CompanyIndustries);
|
|
300
|
+
}
|
|
301
|
+
if (this.targetingLinkedInV2CompanyInterfaceLocations) {
|
|
302
|
+
linkedInV2Company.interfaceLocations =
|
|
303
|
+
parseObject(this.targetingLinkedInV2CompanyInterfaceLocations);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const response = await this.hootsuite.scheduleMessage({
|
|
307
|
+
$,
|
|
308
|
+
data: {
|
|
309
|
+
text: this.text,
|
|
310
|
+
socialProfileIds: parseObject(this.socialProfileIds),
|
|
311
|
+
scheduledSendTime: this.scheduledSendTime,
|
|
312
|
+
webhookUrls: parseObject(this.webhookUrls),
|
|
313
|
+
tags: parseObject(this.tags),
|
|
314
|
+
targeting: {
|
|
315
|
+
...(Object.keys(facebookPage).length > 0
|
|
316
|
+
? {
|
|
317
|
+
facebookPage,
|
|
318
|
+
}
|
|
319
|
+
: {}),
|
|
320
|
+
...(Object.keys(linkedInCompany).length > 0
|
|
321
|
+
? {
|
|
322
|
+
linkedInCompany,
|
|
323
|
+
}
|
|
324
|
+
: {}),
|
|
325
|
+
...(Object.keys(linkedInV2Company).length > 0
|
|
326
|
+
? {
|
|
327
|
+
linkedInV2Company,
|
|
328
|
+
}
|
|
329
|
+
: {}),
|
|
330
|
+
},
|
|
331
|
+
privacy: (this.privacyFacebookVisibility || this.privacyLinkedInVisibility) && {
|
|
332
|
+
...(this.privacyFacebookVisibility
|
|
333
|
+
? {
|
|
334
|
+
facebook: {
|
|
335
|
+
visibility: [
|
|
336
|
+
this.privacyFacebookVisibility,
|
|
337
|
+
],
|
|
338
|
+
},
|
|
339
|
+
}
|
|
340
|
+
: {}),
|
|
341
|
+
...(this.privacyLinkedInVisibility
|
|
342
|
+
? {
|
|
343
|
+
linkedIn: {
|
|
344
|
+
visibility: [
|
|
345
|
+
this.privacyLinkedInVisibility,
|
|
346
|
+
],
|
|
347
|
+
},
|
|
348
|
+
}
|
|
349
|
+
: {}),
|
|
350
|
+
},
|
|
351
|
+
location: {
|
|
352
|
+
latitude: parseFloat(this.latitude),
|
|
353
|
+
longitude: parseFloat(this.longitude),
|
|
354
|
+
},
|
|
355
|
+
emailNotification: this.emailNotification,
|
|
356
|
+
mediaUrls: parseObject(this.mediaUrls)?.map((mediaUrl) => ({
|
|
357
|
+
url: mediaUrl,
|
|
358
|
+
})),
|
|
359
|
+
media: parseObject(this.media)?.map((media) => ({
|
|
360
|
+
id: media,
|
|
361
|
+
})),
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
$.export("$summary", `Successfully scheduled message with ID: ${response.data[0].id}`);
|
|
366
|
+
return response;
|
|
367
|
+
},
|
|
368
|
+
};
|