Skip to content

Commit adc002d

Browse files
committed
Webhook adjustments
1 parent 1f30302 commit adc002d

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

components/salesloft/sources/common/webhook.mjs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { v4 as uuid } from "uuid";
2+
import salesloft from "../../salesloft.app.mjs";
23

34
export default {
45
props: {
5-
salesloft: {
6-
type: "app",
7-
app: "salesloft",
8-
},
6+
salesloft,
97
db: "$.service.db",
8+
http: "$.interface.http",
109
},
1110
methods: {
1211
_getWebhookId() {
@@ -29,6 +28,7 @@ export default {
2928
const response = await this.salesloft.createWebhookSubscription({
3029
data: {
3130
callback_url: this.http.endpoint,
31+
callback_token: `pd_${Date.now()}`,
3232
event_type: this.getEventType(),
3333
},
3434
});
@@ -43,7 +43,9 @@ export default {
4343
},
4444
async run(event) {
4545
const { body } = event;
46-
const meta = this.generateMeta(body);
47-
this.$emit(body, meta);
46+
if (body.id) {
47+
const meta = this.generateMeta(body);
48+
this.$emit(body, meta);
49+
}
4850
},
4951
};

components/salesloft/sources/new-email-activity-instant/new-email-activity-instant.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
...common,
55
key: "salesloft-new-email-activity-instant",
66
name: "New Email Activity (Instant)",
7-
description: "Emit new event when an email activity is updated in Salesloft. [See the documentation](https://developers.salesloft.com/docs/api/webhook-subscriptions/)",
7+
description: "Emit new event when an email is updated in Salesloft. [See the documentation](https://developers.salesloft.com/docs/api/webhook-subscriptions/)",
88
version: "0.0.1",
99
type: "source",
1010
dedupe: "unique",
@@ -14,7 +14,7 @@ export default {
1414
return "email_updated";
1515
},
1616
getSummary(data) {
17-
return `Email activity updated: ${data.subject || data.id}`;
17+
return `Email updated: ${data.subject || data.id}`;
1818
},
1919
},
2020
};

components/salesloft/sources/new-person-instant/new-person-instant.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
return "person_created";
1515
},
1616
getSummary(data) {
17-
return `New person created: ${data.email_address || data.display_name || data.id}`;
17+
return `New person created: ${data.display_name || data.email_address || data.id}`;
1818
},
1919
},
2020
};

0 commit comments

Comments
 (0)