boogiecoco.
07/13/2023, 12:24 AMreshma
07/13/2023, 12:25 AMboogiecoco.
07/13/2023, 12:25 AMboogiecoco.
07/13/2023, 12:25 AMreshma
07/13/2023, 12:26 AMreshma
07/13/2023, 12:26 AMreshma
07/13/2023, 12:26 AMboogiecoco.
07/13/2023, 12:27 AMboogiecoco.
07/13/2023, 12:28 AMreshma
07/13/2023, 12:29 AMboogiecoco.
07/13/2023, 12:31 AMboogiecoco.
07/13/2023, 12:34 AMreshma
07/13/2023, 12:35 AMboogiecoco.
07/13/2023, 12:36 AMboogiecoco.
07/13/2023, 12:36 AMreshma
07/13/2023, 12:37 AMboogiecoco.
07/13/2023, 8:07 AMmedplum.createPdf but it's not working for sendEmail.
I'm running into this error when trying to use the bot to send an email:
{"errorType":"Error","errorMessage":"Failed to send email: Error: Forbidden","trace":["Error: Failed to send email: Error: Forbidden"," at Object.handler (/var/task/user.js:19:15)"," at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"," at async exports.handler (/var/task/index.js:15:12)"]}
email input is: {
"to": "name@gmail.com",
"subject": "Test Subject",
"text": "Test Email Body"
}
code for bot:
`import { BotEvent, MedplumClient, MailOptions } from '@medplum/core';
export async function handler(medplum: MedplumClient, event: BotEvent): Promise {
if (typeof event.input !== 'object' || !event.input) {
throw new Error('Invalid input data');
}
const email = event.input as MailOptions;
try {
const response = await medplum.sendEmail(email);
if (!response) {
throw new Error('Failed to send email');
}
console.log('Email sent successfully');
return true;
} catch (error) {
console.error(Failed to send email: ${error});
throw new Error(${email} Failed to send email: ${error});
}
}
`reshma
07/13/2023, 3:51 PMrahul1
07/13/2023, 4:36 PMboogiecoco.
07/13/2023, 5:04 PMrahul1
07/13/2023, 5:07 PMboogiecoco.
07/13/2023, 5:25 PMboogiecoco.
07/13/2023, 5:30 PM{
"resourceType": "OperationOutcome",
"id": "ok",
"issue": [
{
"severity": "information",
"code": "informational",
"details": {
"text": "All OK"
}
}
]
}
Here is the payload:
{
"to": "vijaypraju04@gmail.com",
"subject": "Test Subject",
"text": "Test Email Body"
}rahul1
07/13/2023, 5:31 PMboogiecoco.
07/13/2023, 5:31 PMboogiecoco.
07/13/2023, 5:32 PMrahul1
07/13/2023, 5:34 PMnodemailer library, so we would support any functionality in that library regarding rendering https://nodemailer.com/message/boogiecoco.
07/13/2023, 5:34 PMrahul1
07/13/2023, 5:35 PMrahul1
07/13/2023, 5:35 PMrahul1
07/13/2023, 5:36 PMboogiecoco.
07/13/2023, 5:42 PMboogiecoco.
07/13/2023, 6:07 PMrahul1
07/13/2023, 6:10 PMboogiecoco.
07/13/2023, 6:14 PMrahul1
07/13/2023, 6:20 PMrahul1
07/13/2023, 6:20 PMboogiecoco.
07/13/2023, 6:32 PMrahul1
07/13/2023, 6:42 PMstatus field which could be either 'in-progress' or 'completed' https://www.medplum.com/docs/api/fhir/resources/questionnaireresponserahul1
07/13/2023, 6:43 PMrahul1
07/13/2023, 8:41 PMboogiecoco.
07/13/2023, 8:56 PMboogiecoco.
07/13/2023, 9:00 PM* See the FHIR "create" operation for full details: https://www.hl7.org/fhir/http.html#create
*
* @category Create
* @param data The binary data to upload.
* @param filename Optional filename for the binary.
* @param contentType Content type for the binary.
* @returns The result of the create operation.
*/
createBinary(data: string | File | Blob | Uint8Array, filename: string | undefined, contentType: string, onProgress?: (e: ProgressEvent) => void): Promise<Binary>;rahul1
07/13/2023, 9:02 PMrahul1
07/13/2023, 9:03 PMboogiecoco.
07/13/2023, 10:02 PMrahul1
07/13/2023, 10:03 PMboogiecoco.
07/14/2023, 7:14 PMrahul1
07/14/2023, 7:19 PMrahul1
07/14/2023, 7:19 PMrahul1
07/14/2023, 7:21 PMboogiecoco.
07/14/2023, 7:33 PMrahul1
07/14/2023, 7:40 PMboogiecoco.
07/14/2023, 8:25 PM