can you please follow these steps and inform me the result?
- Create a new workflow
- Add a new action step
- Search for Salesforce and select Use any Salesforce API in Node.js
- Substitute to all the code below:
- Test
import salesforceWebhooks from "salesforce-webhooks";
const { SalesforceClient } = salesforceWebhooks;
export default defineComponent({
props: {
salesforce_rest_api: {
type: "app",
app: "salesforce_rest_api",
}
},
methods: {
_apiVersion() {
return "50.0";
},
_authToken() {
return this.salesforce_rest_api.$auth.oauth_access_token;
},
_instance() {
return this.salesforce_rest_api.$auth.yourinstance;
},
_instanceUrl() {
return this.salesforce_rest_api.$auth.instance_url;
},
_subdomain() {
return (
this._instance() ||
this._instanceUrl()
.replace("https://", "")
.replace(".[salesforce.com](http://salesforce.com)", "")
);
},
_getSalesforceClient() {
const clientOpts = {
apiVersion: this._apiVersion(),
authToken: this._authToken(),
instance: this._subdomain(),
};
return new SalesforceClient(clientOpts);
},
},
async run({steps, $}) {
const client = this._getSalesforceClient();
const webhookOpts = {
endpointUrl: "https://www.unexistent-endpoint-10845209472.com",
sObjectType: "User",
event: "new",
secretToken: "secret",
};
return client.createWebhook(webhookOpts);
},
})