PipedreamHQ / PipedreamHQ/pipedream

[FEATURE] Sources: support uploading / packaging arbitrary files with component, or referencing via props

Open
#578 0 comments 0 reactions 0 assignees View on GitHub
enhancement tracked internally triaged
Dominant language
JavaScript
Stars
11.7k
Forks
5.8k
Avg merge
3d 10h
Merged PRs (30d)
102

Description

From Jay in public Slack:

"I am extending a discussion I had with @Dylan Sather (Pipedream) during the weekend related to a new use case that might be worth looking into.

The use case came up while working on the Salesforce integration. Salesforce provides webhook customisation through "Apex Triggers" [1], which is a bit more complicated than creating/deleting webhooks through a REST API endpoint.

An Apex trigger is basically custom code written in Apex [2] (it's a programming language built by Salesforce) that is sent and stored in your Salesforce account, and that is executed whenever a certain event occurs. Think of them as a "stored procedure".

Triggers can contain arbitrary code, which must include logic to serialize data into JSON, post the data to a predefined HTTP endpoint, etc.

For the Salesforce integration I'm working on, I had the idea of having some templates for the Apex triggers, and render those templates with specific data determined by the user. For example, a template would look like this:

```
trigger PipedreamNew{{sObject}} on {{sObject}} ({{eventTypes}}) {
String endpointUrl = '{{endpointUrl}}';
for (Object item : Trigger.New) {
String content = Webhook.jsonContent(item);
Webhook.callout(endpointUrl, content);
}
}
```

The parameters here would be `sObject`, `eventTypes` and `endpointUrl`

[1] https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm
[2] https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_intro_what_is_apex.htm (edited) "

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.