Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions components/ringcentral/actions/create-contact/create-contact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import ringcentral from "../../ringcentral.app.mjs";
import utils from "../../common/utils.mjs";

export default {
key: "ringcentral-create-contact",
name: "Create Contact",
description: "Creates a user personal contact. [See the documentation](https://developers.ringcentral.com/api-reference/External-Contacts/createContact)",
version: "0.0.1",
type: "action",
props: {
ringcentral,
accountId: {
propDefinition: [
ringcentral,
"accountId",
],
},
extensionId: {
propDefinition: [
ringcentral,
"extensionId",
],
description: "Internal identifier of the RingCentral extension/user",
},
email: {
type: "string",
label: "Email",
description: "Email address of the contact",
optional: true,
},
firstName: {
type: "string",
label: "First Name",
description: "First name of the contact",
optional: true,
},
lastName: {
type: "string",
label: "Last Name",
description: "Last name of the contact",
optional: true,
},
mobilePhone: {
type: "string",
label: "Mobile Phone",
description: "Mobile phone of the contact",
optional: true,
},
additionalOptions: {
type: "object",
label: "Additional Options",
description: "Additional parameters to set for the contact. [See the documentation](https://developers.ringcentral.com/api-reference/External-Contacts/createContact) for all available parameters. Values will be parsed as JSON where applicable. Example: `{ \"notes\": \"Notes for the contact\" }`",
optional: true,
},
},
methods: {
createContact({
accountId, extensionId, ...args
}) {
return this.ringcentral.makeRequest({
method: "POST",
path: `/account/${accountId}/extension/${extensionId}/address-book/contact`,
...args,
});
},
},
async run({ $ }) {
const { // eslint-disable-next-line no-unused-vars
ringcentral, createContact, accountId, extensionId, additionalOptions, ...data
} = this;

const response =
await createContact({
$,
accountId,
extensionId,
data: {
...data,
...(additionalOptions && utils.parseObjectEntries(additionalOptions)),
},
});

$.export("$summary", `Successfully created contact (ID: ${response.id})`);
return response;
},
};
2 changes: 1 addition & 1 deletion components/ringcentral/actions/send-sms/send-sms.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
key: "ringcentral-send-sms",
name: "Send SMS",
description: "Creates and sends a new text message. See the API docs [here](https://developers.ringcentral.com/api-reference/SMS/createSMSMessage)",
version: "0.5.1",
version: "0.5.2",
type: "action",
props: {
ringcentral,
Expand All @@ -32,7 +32,7 @@
label: "To Phone Numbers",
description: "Phone number of receiver(s) of an SMS message. Phone number in [E.164 format](https://en.wikipedia.org/wiki/E.164#Numbering_formats) e.g. `+16502223366`.",
},
text: {

Check warning on line 35 in components/ringcentral/actions/send-sms/send-sms.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop text must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "string",
description: "Text of a message. Max length is 1000 symbols (2-byte [UTF-16](https://en.wikipedia.org/wiki/UTF-16) encoded). If a character is encoded in 4 bytes in UTF-16 it is treated as 2 characters, thus restricting the maximum message length to 500 symbols.",
},
Expand Down
24 changes: 24 additions & 0 deletions components/ringcentral/common/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,32 @@ function parse(value) {
}
}

function optionalParseAsJSON(value) {
try {
return JSON.parse(value);
} catch (e) {
return value;
}
}

function parseObjectEntries(value) {
const obj = typeof value === "string"
? JSON.parse(value)
: value;
return Object.fromEntries(
Object.entries(obj).map(([
key,
value,
]) => [
key,
optionalParseAsJSON(value),
]),
);
}

export default {
emptyStrToUndefined,
parse,
emptyObjectToUndefined,
parseObjectEntries,
};
4 changes: 2 additions & 2 deletions components/ringcentral/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/ringcentral",
"version": "0.4.1",
"version": "0.5.0",
"description": "Pipedream Ringcentral Components",
"main": "ringcentral.app.mjs",
"keywords": [
Expand All @@ -14,6 +14,6 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.2.0"
"@pipedream/platform": "^3.0.3"
}
}
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading