Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-ayoub-segment committed Nov 13, 2024
1 parent 90c6af7 commit 0e91cb5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { Payload } from './generated-types'
const action: ActionDefinition<Settings, Payload> = {
title: 'Custom Events',
description: 'Send user actions to Attentive',
defaultSubscription: 'type = "track"',
fields: {
type: {
label: 'Type',
Expand Down Expand Up @@ -89,7 +90,10 @@ const action: ActionDefinition<Settings, Payload> = {
label: 'External Event Id',
description: 'A unique identifier representing this specific event. A UUID is recommended.',
type: 'string',
required: false
required: false,
default: {
'@path': '$.messageId'
}
},
occurredAt: {
label: 'Occurred At',
Expand Down Expand Up @@ -138,4 +142,4 @@ const action: ActionDefinition<Settings, Payload> = {
}
}

export default action
export default action
41 changes: 23 additions & 18 deletions packages/destination-actions/src/destinations/attentive/index.ts
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

0 comments on commit 0e91cb5

Please sign in to comment.