feat(disqus): add new flagged comments trigger
This commit is contained in:
@@ -10,7 +10,7 @@ export default defineApp({
|
|||||||
baseUrl: 'https://disqus.com',
|
baseUrl: 'https://disqus.com',
|
||||||
apiBaseUrl: 'https://disqus.com/api',
|
apiBaseUrl: 'https://disqus.com/api',
|
||||||
iconUrl: '{BASE_URL}/apps/disqus/assets/favicon.svg',
|
iconUrl: '{BASE_URL}/apps/disqus/assets/favicon.svg',
|
||||||
authDocUrl: 'https://automatisch.io/docs/apps/disqus/connection',
|
authDocUrl: '{DOCS_URL}/apps/disqus/connection',
|
||||||
primaryColor: '2E9FFF',
|
primaryColor: '2E9FFF',
|
||||||
supportsConnections: true,
|
supportsConnections: true,
|
||||||
beforeRequest: [addAuthHeader],
|
beforeRequest: [addAuthHeader],
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
import newComments from './new-comments/index.js';
|
import newComments from './new-comments/index.js';
|
||||||
|
import newFlaggedComments from './new-flagged-comments/index.js';
|
||||||
|
|
||||||
export default [newComments];
|
export default [newComments, newFlaggedComments];
|
||||||
|
@@ -0,0 +1,59 @@
|
|||||||
|
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||||
|
import { URLSearchParams } from 'url';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New flagged comments',
|
||||||
|
key: 'newFlaggedComments',
|
||||||
|
pollInterval: 15,
|
||||||
|
description: 'Triggers when a Disqus comment is marked with a flag',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
label: 'Forum',
|
||||||
|
key: 'forumId',
|
||||||
|
type: 'dropdown',
|
||||||
|
required: true,
|
||||||
|
description: 'Select the forum where you want comments to be triggered.',
|
||||||
|
variables: true,
|
||||||
|
source: {
|
||||||
|
type: 'query',
|
||||||
|
name: 'getDynamicData',
|
||||||
|
arguments: [
|
||||||
|
{
|
||||||
|
name: 'key',
|
||||||
|
value: 'listForums',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const forumId = $.step.parameters.forumId;
|
||||||
|
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
limit: '100',
|
||||||
|
forum: forumId,
|
||||||
|
filters: [5], // Is_Flagged
|
||||||
|
});
|
||||||
|
|
||||||
|
let more;
|
||||||
|
do {
|
||||||
|
const { data } = await $.http.get(
|
||||||
|
`/3.0/posts/list.json?${params.toString()}`
|
||||||
|
);
|
||||||
|
params.set('cursor', data.cursor.next);
|
||||||
|
more = data.cursor.hasNext;
|
||||||
|
|
||||||
|
if (data.response?.length) {
|
||||||
|
for (const comment of data.response) {
|
||||||
|
$.pushTriggerItem({
|
||||||
|
raw: comment,
|
||||||
|
meta: {
|
||||||
|
internalId: comment.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (more);
|
||||||
|
},
|
||||||
|
});
|
@@ -3,6 +3,8 @@ favicon: /favicons/disqus.svg
|
|||||||
items:
|
items:
|
||||||
- name: New comments
|
- name: New comments
|
||||||
desc: Triggers when a new comment is posted in a forum using Disqus.
|
desc: Triggers when a new comment is posted in a forum using Disqus.
|
||||||
|
- name: New flagged comments
|
||||||
|
desc: Triggers when a Disqus comment is marked with a flag.
|
||||||
---
|
---
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
Reference in New Issue
Block a user