upload-post 2.6.0 → 2.7.0
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/index.d.ts +84 -2
- package/index.js +106 -9
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -782,7 +782,27 @@ declare module 'upload-post' {
|
|
|
782
782
|
// Instagram Comments
|
|
783
783
|
|
|
784
784
|
/**
|
|
785
|
-
* Get comments on
|
|
785
|
+
* Get comments on a post
|
|
786
|
+
* @param options - Query options
|
|
787
|
+
*/
|
|
788
|
+
getPostComments(options: {
|
|
789
|
+
user: string;
|
|
790
|
+
platform?: 'instagram' | 'facebook' | 'youtube' | 'linkedin';
|
|
791
|
+
postId?: string;
|
|
792
|
+
postUrl?: string;
|
|
793
|
+
limit?: number;
|
|
794
|
+
after?: string;
|
|
795
|
+
}): Promise<{
|
|
796
|
+
success: boolean;
|
|
797
|
+
comments?: Array<{
|
|
798
|
+
id: string;
|
|
799
|
+
text: string;
|
|
800
|
+
timestamp: string;
|
|
801
|
+
user: { id: string; username: string };
|
|
802
|
+
}>;
|
|
803
|
+
}>;
|
|
804
|
+
/**
|
|
805
|
+
* Get comments on an Instagram post (legacy positional signature)
|
|
786
806
|
* @param user - Profile username
|
|
787
807
|
* @param options - Query options
|
|
788
808
|
*/
|
|
@@ -800,7 +820,7 @@ declare module 'upload-post' {
|
|
|
800
820
|
* Send a private reply (DM) to the author of an Instagram comment
|
|
801
821
|
* @param options - Reply options
|
|
802
822
|
*/
|
|
803
|
-
replyToComment(options: { user: string; commentId: string; message: string }): Promise<{
|
|
823
|
+
replyToComment(options: { user: string; commentId: string; message: string; buttons?: Array<{ title: string; url: string }> }): Promise<{
|
|
804
824
|
success: boolean;
|
|
805
825
|
recipient_id?: string;
|
|
806
826
|
message_id?: string;
|
|
@@ -819,6 +839,68 @@ declare module 'upload-post' {
|
|
|
819
839
|
error?: string;
|
|
820
840
|
}>;
|
|
821
841
|
|
|
842
|
+
/**
|
|
843
|
+
* Create a comment on a post, or reply to an existing comment.
|
|
844
|
+
* One of postId, postUrl, or commentId is required.
|
|
845
|
+
* @param options - Comment options
|
|
846
|
+
*/
|
|
847
|
+
createComment(options: {
|
|
848
|
+
user: string;
|
|
849
|
+
platform: 'instagram' | 'facebook' | 'youtube' | 'linkedin';
|
|
850
|
+
message: string;
|
|
851
|
+
postId?: string;
|
|
852
|
+
postUrl?: string;
|
|
853
|
+
commentId?: string;
|
|
854
|
+
}): Promise<{
|
|
855
|
+
success: boolean;
|
|
856
|
+
id?: string;
|
|
857
|
+
message?: string;
|
|
858
|
+
error?: string;
|
|
859
|
+
}>;
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* Delete a comment on a post
|
|
863
|
+
* @param options - Delete options
|
|
864
|
+
*/
|
|
865
|
+
deleteComment(options: {
|
|
866
|
+
user: string;
|
|
867
|
+
platform: 'instagram' | 'facebook' | 'youtube' | 'linkedin';
|
|
868
|
+
commentId: string;
|
|
869
|
+
/** Post identifier (the post URN for LinkedIn) */
|
|
870
|
+
postId?: string;
|
|
871
|
+
}): Promise<{
|
|
872
|
+
success: boolean;
|
|
873
|
+
message?: string;
|
|
874
|
+
error?: string;
|
|
875
|
+
}>;
|
|
876
|
+
|
|
877
|
+
// Post Management
|
|
878
|
+
/**
|
|
879
|
+
* Retry a failed post. Provide requestId or jobId.
|
|
880
|
+
* @param options - Retry options
|
|
881
|
+
*/
|
|
882
|
+
retryPost(options: { requestId?: string; jobId?: string }): Promise<{
|
|
883
|
+
success: boolean;
|
|
884
|
+
request_id?: string;
|
|
885
|
+
job_id?: string;
|
|
886
|
+
message?: string;
|
|
887
|
+
error?: string;
|
|
888
|
+
}>;
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* Unpublish (delete) a post from the platform
|
|
892
|
+
* @param options - Unpublish options
|
|
893
|
+
*/
|
|
894
|
+
unpublishPost(options: {
|
|
895
|
+
user: string;
|
|
896
|
+
platform: 'facebook' | 'youtube' | 'x' | 'linkedin' | 'threads';
|
|
897
|
+
postId: string;
|
|
898
|
+
}): Promise<{
|
|
899
|
+
success: boolean;
|
|
900
|
+
message?: string;
|
|
901
|
+
error?: string;
|
|
902
|
+
}>;
|
|
903
|
+
|
|
822
904
|
// Helper Endpoints
|
|
823
905
|
/**
|
|
824
906
|
* Get Facebook pages for a profile
|
package/index.js
CHANGED
|
@@ -749,7 +749,7 @@ export class UploadPost {
|
|
|
749
749
|
* @param {Object} [options] - Query options
|
|
750
750
|
* @param {string[]} [options.platforms] - Filter by platforms (instagram, linkedin, facebook, x, youtube, tiktok, threads, pinterest, reddit)
|
|
751
751
|
* @param {string} [options.pageId] - Facebook Page ID (required for Facebook analytics)
|
|
752
|
-
* @param {string} [options.pageUrn] - LinkedIn page URN
|
|
752
|
+
* @param {string} [options.pageUrn] - LinkedIn organization/company page URN or numeric ID. LinkedIn analytics are only available for pages you administer; personal profiles are not supported (LinkedIn exposes no member-level analytics). Defaults to the first administered organization page.
|
|
753
753
|
* @returns {Promise<Object>} Analytics data per platform
|
|
754
754
|
*/
|
|
755
755
|
async getAnalytics(profileUsername, options = {}) {
|
|
@@ -1023,18 +1023,27 @@ export class UploadPost {
|
|
|
1023
1023
|
// ==================== Instagram Comments ====================
|
|
1024
1024
|
|
|
1025
1025
|
/**
|
|
1026
|
-
* Get comments on
|
|
1026
|
+
* Get comments on a post
|
|
1027
1027
|
*
|
|
1028
|
-
* @param {string} user - Profile username
|
|
1029
1028
|
* @param {Object} options - Query options
|
|
1030
|
-
* @param {string}
|
|
1031
|
-
* @param {string} [options.
|
|
1029
|
+
* @param {string} options.user - Profile username
|
|
1030
|
+
* @param {string} [options.platform='instagram'] - Platform (instagram, facebook, youtube, linkedin)
|
|
1031
|
+
* @param {string} [options.postId] - Native post/media ID (provide postId or postUrl)
|
|
1032
|
+
* @param {string} [options.postUrl] - Full post URL (provide postId or postUrl)
|
|
1033
|
+
* @param {number} [options.limit] - Max number of comments to return
|
|
1034
|
+
* @param {string} [options.after] - Pagination cursor for the next page
|
|
1032
1035
|
* @returns {Promise<Object>} Comments data
|
|
1033
1036
|
*/
|
|
1034
|
-
async getPostComments(
|
|
1035
|
-
|
|
1037
|
+
async getPostComments(options = {}) {
|
|
1038
|
+
// Backwards compatibility: getPostComments(user, { postId, postUrl })
|
|
1039
|
+
if (typeof options === 'string') {
|
|
1040
|
+
options = { user: options, ...(arguments[1] || {}) };
|
|
1041
|
+
}
|
|
1042
|
+
const params = { platform: options.platform || 'instagram', user: options.user };
|
|
1036
1043
|
if (options.postId) params.post_id = options.postId;
|
|
1037
1044
|
if (options.postUrl) params.post_url = options.postUrl;
|
|
1045
|
+
if (options.limit !== undefined) params.limit = options.limit;
|
|
1046
|
+
if (options.after) params.after = options.after;
|
|
1038
1047
|
return this._request('/uploadposts/comments', 'GET', params);
|
|
1039
1048
|
}
|
|
1040
1049
|
|
|
@@ -1045,15 +1054,19 @@ export class UploadPost {
|
|
|
1045
1054
|
* @param {string} options.user - Profile username
|
|
1046
1055
|
* @param {string} options.commentId - Comment ID from getPostComments
|
|
1047
1056
|
* @param {string} options.message - Reply message text
|
|
1057
|
+
* @param {Array<{title: string, url: string}>} [options.buttons] - Optional web_url
|
|
1058
|
+
* buttons (max 3) rendered in the Instagram DM. Each item is `{ title, url }`.
|
|
1048
1059
|
* @returns {Promise<Object>} Reply result
|
|
1049
1060
|
*/
|
|
1050
1061
|
async replyToComment(options) {
|
|
1051
|
-
|
|
1062
|
+
const body = {
|
|
1052
1063
|
platform: 'instagram',
|
|
1053
1064
|
user: options.user,
|
|
1054
1065
|
comment_id: options.commentId,
|
|
1055
1066
|
message: options.message
|
|
1056
|
-
}
|
|
1067
|
+
};
|
|
1068
|
+
if (options.buttons) body.buttons = options.buttons;
|
|
1069
|
+
return this._request('/uploadposts/comments/reply', 'POST', body);
|
|
1057
1070
|
}
|
|
1058
1071
|
|
|
1059
1072
|
/**
|
|
@@ -1074,6 +1087,90 @@ export class UploadPost {
|
|
|
1074
1087
|
});
|
|
1075
1088
|
}
|
|
1076
1089
|
|
|
1090
|
+
/**
|
|
1091
|
+
* Create a comment on a post, or reply to an existing comment
|
|
1092
|
+
*
|
|
1093
|
+
* One of postId, postUrl, or commentId is required. Pass commentId to reply
|
|
1094
|
+
* to an existing comment; pass postId/postUrl to comment on the post itself.
|
|
1095
|
+
*
|
|
1096
|
+
* @param {Object} options - Comment options
|
|
1097
|
+
* @param {string} options.user - Profile username
|
|
1098
|
+
* @param {string} options.platform - Platform (instagram, facebook, youtube, linkedin)
|
|
1099
|
+
* @param {string} options.message - Comment text
|
|
1100
|
+
* @param {string} [options.postId] - Native post/media ID to comment on
|
|
1101
|
+
* @param {string} [options.postUrl] - Full post URL to comment on
|
|
1102
|
+
* @param {string} [options.commentId] - Existing comment ID to reply to
|
|
1103
|
+
* @returns {Promise<Object>} Created comment result
|
|
1104
|
+
*/
|
|
1105
|
+
async createComment(options) {
|
|
1106
|
+
const body = {
|
|
1107
|
+
platform: options.platform,
|
|
1108
|
+
user: options.user,
|
|
1109
|
+
message: options.message
|
|
1110
|
+
};
|
|
1111
|
+
if (options.commentId) body.comment_id = options.commentId;
|
|
1112
|
+
if (options.postId) body.post_id = options.postId;
|
|
1113
|
+
if (options.postUrl) body.post_url = options.postUrl;
|
|
1114
|
+
return this._request('/uploadposts/comments/create', 'POST', body);
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* Delete a comment on a post
|
|
1119
|
+
*
|
|
1120
|
+
* @param {Object} options - Delete options
|
|
1121
|
+
* @param {string} options.user - Profile username
|
|
1122
|
+
* @param {string} options.platform - Platform (instagram, facebook, youtube, linkedin)
|
|
1123
|
+
* @param {string} options.commentId - Comment ID to delete
|
|
1124
|
+
* @param {string} [options.postId] - Post identifier (the post URN for LinkedIn)
|
|
1125
|
+
* @returns {Promise<Object>} Deletion result
|
|
1126
|
+
*/
|
|
1127
|
+
async deleteComment(options) {
|
|
1128
|
+
const body = {
|
|
1129
|
+
platform: options.platform,
|
|
1130
|
+
user: options.user,
|
|
1131
|
+
comment_id: options.commentId
|
|
1132
|
+
};
|
|
1133
|
+
if (options.postId) body.post_id = options.postId;
|
|
1134
|
+
return this._request('/uploadposts/comments/delete', 'DELETE', body);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
// ==================== Post Management ====================
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* Retry a failed post
|
|
1141
|
+
*
|
|
1142
|
+
* Provide the request_id (from an async upload) or the job_id (from a
|
|
1143
|
+
* scheduled/queued upload).
|
|
1144
|
+
*
|
|
1145
|
+
* @param {Object} options - Retry options
|
|
1146
|
+
* @param {string} [options.requestId] - The request_id of the post to retry
|
|
1147
|
+
* @param {string} [options.jobId] - The job_id of the post to retry
|
|
1148
|
+
* @returns {Promise<Object>} Retry result
|
|
1149
|
+
*/
|
|
1150
|
+
async retryPost(options = {}) {
|
|
1151
|
+
const body = {};
|
|
1152
|
+
if (options.requestId) body.request_id = options.requestId;
|
|
1153
|
+
if (options.jobId) body.job_id = options.jobId;
|
|
1154
|
+
return this._request('/uploadposts/posts/retry', 'POST', body);
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* Unpublish (delete) a post from the platform
|
|
1159
|
+
*
|
|
1160
|
+
* @param {Object} options - Unpublish options
|
|
1161
|
+
* @param {string} options.user - Profile username
|
|
1162
|
+
* @param {string} options.platform - Platform (facebook, youtube, x, linkedin, threads)
|
|
1163
|
+
* @param {string} options.postId - Native post ID to unpublish
|
|
1164
|
+
* @returns {Promise<Object>} Unpublish result
|
|
1165
|
+
*/
|
|
1166
|
+
async unpublishPost(options) {
|
|
1167
|
+
return this._request('/uploadposts/posts/unpublish', 'POST', {
|
|
1168
|
+
platform: options.platform,
|
|
1169
|
+
user: options.user,
|
|
1170
|
+
post_id: options.postId
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1077
1174
|
// ==================== Helper Endpoints ====================
|
|
1078
1175
|
|
|
1079
1176
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "upload-post",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Official client library for Upload-Post API - Cross-platform social media upload for TikTok, Instagram, YouTube, LinkedIn, Facebook, Pinterest, Threads, Reddit, Bluesky, and X (Twitter)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|