7203 support emails links phones in zapier inputs 2 (#7562)
## Done - add `EMAILS`, `PHONES`, `LINKS`, `RICH_TEXT`, `POSITION`, and `ARRAY` field support in Twenty zapier integration - fix `twenty-zapier` package tests and requirements ## Emails <img width="791" alt="image" src="https://github.com/user-attachments/assets/7987a1a2-6076-4715-9221-d4a1898b7634"> ## Links <img width="797" alt="image" src="https://github.com/user-attachments/assets/b94ce972-fae2-4953-b9e8-79c0478f5f60"> ## Phones <img width="789" alt="image" src="https://github.com/user-attachments/assets/7234eaaf-40b8-4772-8880-c58ba47618c5"> ## Array <img width="834" alt="image" src="https://github.com/user-attachments/assets/99cb6795-e428-40ea-9c3a-d52561c2c6e1">
This commit is contained in:
@ -1,5 +1,17 @@
|
||||
import { InputData } from '../utils/data.types';
|
||||
|
||||
const OBJECT_SUBFIELD_NAMES = ['secondaryLinks', 'additionalPhones'];
|
||||
|
||||
const formatArrayInputData = (
|
||||
key: string,
|
||||
arrayInputData: InputData,
|
||||
): string => {
|
||||
if (OBJECT_SUBFIELD_NAMES.includes(key)) {
|
||||
return `${arrayInputData[key].join('","')}`;
|
||||
}
|
||||
return `"${arrayInputData[key].join('","')}"`;
|
||||
};
|
||||
|
||||
const handleQueryParams = (inputData: InputData): string => {
|
||||
const formattedInputData: InputData = {};
|
||||
Object.keys(inputData).forEach((key) => {
|
||||
@ -17,7 +29,11 @@ const handleQueryParams = (inputData: InputData): string => {
|
||||
let result = '';
|
||||
Object.keys(formattedInputData).forEach((key) => {
|
||||
let quote = '';
|
||||
if (typeof formattedInputData[key] === 'object') {
|
||||
if (Array.isArray(formattedInputData[key])) {
|
||||
result = result.concat(
|
||||
`${key}: [${formatArrayInputData(key, formattedInputData)}], `,
|
||||
);
|
||||
} else if (typeof formattedInputData[key] === 'object') {
|
||||
result = result.concat(
|
||||
`${key}: {${handleQueryParams(formattedInputData[key])}}, `,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user