START_EVENT 2023-09-26 (C) Questetra, Inc. (MIT License) 3 This item starts a process when Outlook has received a new message. このアイテムは、Outlook が新しいメールを受信すると、プロセスを開始します。 https://support.questetra.com/bpmn-icons/start-event-outlook-message-received/ https://support.questetra.com/ja/bpmn-icons/start-event-outlook-message-received/ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAA/RJREFUWEfN l1tsDFEYx/+z7W7X7rZFS1nLA42kCU0QEg9oS4IgfXF5ERVxefAg7n1o0bhkoy6RkIhEiMSt4pII xYNu9cElrqUqhApFabub7W679z1yzsys2Z2ZnWlTYV52Zuec7/t95/y/73zD4R9fXL/8V34tAbjd kjklwr2L/yWNAFxwjhWeta3rA6j8uifFsbZlkBo4x+7RGpge4E/EYqRa9hTepwdRBxhQ1Gp86hDK AIPqXIRShpAD/BXn6hDJADqcP9k4AsWjjLq04A8TTKj9CW8wLhlPSqVZkgLQTrQsxw+MAacvd5ip BWe6cfd9UGrWBaejVPzjjykd0dNJFOBJexg763vgWp+Pps9hVN/rYfburMnDT38cFXUeLC4yY9ss mxIArReJFJUAJEc/qcCIeYVZsgU5sigX77uiOPm4F0cX56KuOYAVF91snK/GjjZ3FMXHfqFiqgVn lw1TAQDgdDDfPACf7w1Sb/4aO6wm7bUORgk6e/k9duRkIEaAH74YbCYOw4YY1AHAa0EEkFW60D47 TBn8a0KANk8U0ThQmJcJg4QrHCNw9/EABTYeoKs3BqvJgOwsLg0ALdmOUgGgnUafVO1EgEiMYMaJ TpSMz4LZyOHamwCaN41EViY/dcBbwM4MHQDHH/YiECHYPtvGHNJnuuxUYPRq+BTCjnpehE0b8vHD F8fyC26UF5lRVZaN/Q0+VAkiTRFUEoAs/cQVWHreja2zbJg5zsTmP/oSRu0DP66uHK6VsYn32257 cbjJLx/vdAgZXSnPfxGA0tN9Xz3NwgxcehXAh+4oqsuy2fPrjghOP+1j9wcX5sATIGj8FMLy4iEJ h4ea/Nh+25sWQFUDPSGCwtoOnCgfygxsueVF65YCpnJ6NbaFUHKqi93TNLQaOVao4gS48LIPK6dY oAKgTwPUcChKcP9jiKmfilEUoBjSZ08M9z4EsW66lTl//j2C8nPdTCudVaMHBhDYa4dZULraZtMU vN4SxArJclMBXnkdYFPyrYY0AHw1VC1E1OiSInPCd77FgPkTzWzPmzsi7P+brUFcbg5git2ImxV5 GJOTAV+IYFWdGzfeBrUAJIWIWlMQojRyegK+2jQSO+q9LAuUrl1zs1FdloNMA/DwSxhrr3rQsrlA eQuSSjEDSN/3iQAvvkfw7FtYNQVzzQYsm8xnABUi1Y1chEqHEb8KsmwQPVmMHDy7RyfKsypBygta xpec68atd5IjWYieDk1tSGSHkl5H+sclt2b/WUsmhqGzOdEfNR2ptyn9KxD9bcsHD8IlRK76qabd 8uhIUeWtGIxPs1TLrHWjjQs3R3iV8nGa2OtB/jjtn9r6Nfo39MDfMN80fiMAAAAASUVORK5CYII= { const oauth2 = httpClient.createAuthSettingOAuth2( 'Outlook', 'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize', 'https://login.microsoftonline.com/organizations/oauth2/v2.0/token', 'https://graph.microsoft.com/Mail.Read offline_access', 'client_id', 'client_secret', 'access_token' ); configs.putObject('conf_OAuth2', oauth2); configs.put('conf_Category', category); }; /** * メール一覧を取得する GET リクエストのテスト * @param {Object} request * @param request.url * @param request.method * @param category * @param limit * @param timestampLowerLimit */ const assertRequest = ({url, method}, category, limit, timestampLowerLimit) => { const query = `receivedDateTime ge ${dateFormatter.format('UTC', DATETIME_FORMAT, timestampLowerLimit)} and categories/any(c:c eq '${category}')`; const expectedUrl = 'https://graph.microsoft.com/v1.0/me/messages' + `?${generateQueryString('$top', limit)}` + `&${generateQueryString('$select', 'id,receivedDateTime,internetMessageId')}` + `&${generateQueryString('$orderby', 'receivedDateTime DESC')}` + `&${generateQueryString('$filter', query)}`; expect(url).toEqual(expectedUrl); expect(method).toEqual('GET'); }; /** * クエリパラメータのテスト用の文字列を生成する * @param key * @param value * @returns {String} */ const generateQueryString = (key, value) => { const encodedKey = encodeURIComponent(key); const encodedValue = encodeURIComponent(value) .replace(/%20/g, '+') // HttpRequestWrapper#queryParam() はスペースを + に置き換える .replace(/'/g, '%27') // encodeURIComponent() でエンコードされない文字をエンコード .replace(/\(/g, '%28') .replace(/\)/g, '%29'); return `${encodedKey}=${encodedValue}`; }; /** * 返り値の message のテスト * @param message * @param id * @param timestampAsDatetimeStr * @param rfc822msgId */ const assertMessage = (message, id, timestampAsDatetimeStr, rfc822msgId) => { expect(message.id).toEqual(id); expect(message.timestamp) .toEqual(dateFormatter.parse(DATETIME_FORMAT, timestampAsDatetimeStr)); expect(message.rfc822msgId).toEqual(rfc822msgId); }; const SAMPLE_MESSAGE_LIST_RES = { "value": [ { "id": "abc123", "receivedDateTime": "2023-08-31T20:00:00Z", "internetMessageId": "rfc822msgId-1234567" }, { "id": "def456", "receivedDateTime": "2023-08-31T10:00:00Z", "internetMessageId": "rfc822msgId-4567890" }, { "id": "efg789", "receivedDateTime": "2023-08-31T05:00:00Z", "internetMessageId": "rfc822msgId-7890123" } ] }; /** * 正常系のテストケース */ test('Success', () => { prepareConfigs('カテゴリ 1'); //