-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90c6af7
commit 0e91cb5
Showing
2 changed files
with
29 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 23 additions & 18 deletions
41
packages/destination-actions/src/destinations/attentive/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,53 @@ | ||
import type { DestinationDefinition } from '@segment/actions-core'; | ||
import type { Settings } from './generated-types'; | ||
|
||
import customEvents from './customEvents'; | ||
import { DestinationDefinition, defaultValues } from '@segment/actions-core' | ||
import type { Settings } from './generated-types' | ||
import customEvents from './customEvents' | ||
|
||
const destination: DestinationDefinition<Settings> = { | ||
name: 'Attentive', | ||
slug: 'actions-attentive', | ||
mode: 'cloud', | ||
|
||
description: 'Send Segment anallytics event data to Attentive.', | ||
authentication: { | ||
scheme: 'custom', | ||
fields: { | ||
apiKey: { | ||
label: 'API Key', | ||
description: 'Your Attentive API Key.', | ||
type: 'string', | ||
required: true, | ||
}, | ||
required: true | ||
} | ||
}, | ||
testAuthentication: async (request, { settings }) => { | ||
// Return a request that tests/validates the user's credentials. | ||
// This example sends a test request to a sample endpoint. | ||
return request('https://api.attentivemobile.com/v1/me', { | ||
method: 'GET', | ||
headers: { | ||
Authorization: `Bearer ${settings.apiKey}`, | ||
}, | ||
}); | ||
}, | ||
Authorization: `Bearer ${settings.apiKey}` | ||
} | ||
}) | ||
} | ||
}, | ||
|
||
extendRequest({ settings }) { | ||
return { | ||
headers: { | ||
Authorization: `Bearer ${settings.apiKey}`, | ||
'Content-Type': 'application/json', | ||
'Content-Type': 'application/json' | ||
}, | ||
}; | ||
}, | ||
|
||
actions: { | ||
customEvents, | ||
customEvents | ||
}, | ||
}; | ||
presets: [ | ||
{ | ||
name: 'Track Event', | ||
subscribe: 'type = "track"', | ||
partnerAction: 'customEvents', | ||
mapping: defaultValues(customEvents.fields), | ||
type: 'automatic' | ||
} | ||
] | ||
} | ||
|
||
export default destination; | ||
export default destination | ||
|