Skip to content

Commit

Permalink
feat(intercom): [nan-1916] add fetch article action (#60)
Browse files Browse the repository at this point in the history
## Describe your changes
Add intercom fetch articl action

## Issue ticket number and link
NAN-1916

## Checklist before requesting a review (skip if just adding/editing
APIs & templates)
- [ ] I added tests, otherwise the reason is:
- [ ] External API requests have `retries`
- [ ] Pagination is used where appropriate
- [ ] The built in `nango.paginate` call is used instead of a `while
(true)` loop
- [ ] Third party requests are NOT parallelized (this can cause issues
with rate limits)
- [ ] If a sync requires metadata the `nango.yaml` has `auto_start:
false`
- [ ] If the sync is a `full` sync then `track_deletes: true` is set
  • Loading branch information
khaliqgant authored Oct 19, 2024
1 parent 79f0ab5 commit 6f59edc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
12 changes: 10 additions & 2 deletions flows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3394,6 +3394,12 @@ integrations:
campaign_id: string
name: string
intercom:
actions:
fetch-article:
description: Fetch a single article from Intercom
input: IdEntity
endpoint: GET /single-article
output: Article
syncs:
conversations:
runs: every 6 hours
Expand Down Expand Up @@ -3426,6 +3432,8 @@ integrations:
version: 1.0.0
endpoint: GET /articles
models:
IdEntity:
id: string
Contact:
id: string
workspace_id: string
Expand Down Expand Up @@ -3574,8 +3582,8 @@ integrations:
models:
JiraIssueMetadata:
projectIdsToSync: JiraProjectId[]
cloudId: string
baseUrl: string
cloudId?: string
baseUrl?: string
JiraProjectId:
id: string
Timestamps:
Expand Down
20 changes: 20 additions & 0 deletions integrations/intercom/actions/fetch-article.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { NangoAction, ProxyConfiguration, Article, IdEntity } from '../../models';
import { toArticle } from '../mappers/to-article.js';

export default async function runAction(nango: NangoAction, input: IdEntity): Promise<Article> {
if (!input.id) {
throw new nango.ActionError({
message: 'Id is required to delete a user'
});
}

const config: ProxyConfiguration = {
// https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/retrievearticle
endpoint: `/articles/${input.id}`,
retries: 10
};

const response = await nango.get(config);

return toArticle(response.data);
}
8 changes: 8 additions & 0 deletions integrations/intercom/nango.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
integrations:
intercom:
actions:
fetch-article:
description: Fetch a single article from Intercom
input: IdEntity
endpoint: GET /single-article
output: Article
syncs:
conversations:
runs: every 6 hours
Expand Down Expand Up @@ -32,6 +38,8 @@ integrations:
version: 1.0.0
endpoint: GET /articles
models:
IdEntity:
id: string
Contact:
id: string
workspace_id: string
Expand Down
4 changes: 2 additions & 2 deletions integrations/jira/nango.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ integrations:
models:
JiraIssueMetadata:
projectIdsToSync: JiraProjectId[]
cloudId: string
baseUrl: string
cloudId?: string
baseUrl?: string
JiraProjectId:
id: string
Timestamps:
Expand Down

0 comments on commit 6f59edc

Please sign in to comment.