BotreamDocs Website v0.1.16

Email & API commands

mail · restapi

mail Mail

Sends email and works with a mailbox (IMAP): read lists messages as records; their Id is what saveattachments, move, delete and markread take. send uses the mail settings of the Botream server unless --smtp names another server. The account of a mailbox (or of --smtp) comes from a vault credential (--vault, --credential) or is typed in (--username, --password; the password is then stored in the task as plain text — prefer a credential).

Parameters of every variant

ParameterValueDefaultDescription
--retrynumberNumber of retry attempts. When not set, screen and file commands try once more after a passing problem (a page still loading, a covered element, a locked file); 0 turns that off
--retryintervalnumber1Seconds between retries

Actions (--action)

--action:send

Sends a message. Without --smtp it goes out with the mail settings of the Botream server (Administration → Settings → Mail (SMTP)), so only --to, --subject and --body are needed. With --smtp it goes through that server with its own account. A failed send is not repeated by --retry once the server may have taken the message.

ParameterValueDefaultDescription
--to requiredtextRecipients, separated by , or ;
--subject requiredtext
--body requiredtext
--attachmenttextFile paths, separated by , or ; A file on the agent machine.
--cctextCopy recipients, separated by , or ;
--bcctextBlind copy recipients, separated by , or ;
--replytotextAddress that replies go to, when not the sender
--bodytypeone of text, htmltext
--priorityone of low, normal, highnormalImportance shown by mail programs
--fromtextSender address, e.g. bot@company.com or "Robot <bot@company.com>". Without --smtp: the sender address of the server's mail settings when empty
--smtptextYour own SMTP server, e.g. smtp.gmail.com or smtp.office365.com. Leave empty to send with the mail settings of the Botream server
--portnumberWith --smtp: 587 (STARTTLS, usual), 465 (TLS) or 25 (internal relays)
--vaulttextVault that holds the mail account (Vaults page); --credential is then the name of the credential in it
--credentialany valueWith --smtp: The mail account: the name of a credential in --vault (its user name and password, kept on the Vaults page), or a credential variable ($cred$). Gmail, Outlook.com and Yahoo need an app password; with --authtype:oauth2 the credential is the app registration (client id / client secret). Or type in --username and --password instead; leave all empty for a relay that takes mail without signing in
--usernametextThe user name of the mail account (usually its address), typed in instead of --credential; with --authtype:oauth2 the client id of the app registration
--passwordtextThe password (or app password) for --username. It is stored in the task as plain text: prefer a vault credential (--vault, --credential)
--securityone of auto, ssl, starttls, noneautoauto: TLS on ports 465/993, STARTTLS when the server offers it on other ports (a password is never sent unencrypted); ssl: TLS from the start; starttls: must switch to TLS; none: unencrypted (internal servers only)
--ssltrue / falseOlder form of --security: false = none, true = TLS or STARTTLS (--security wins when both are set)
--timeoutnumber60Seconds to wait for the mail server before giving up
--ignoresslerrorstrue / falsefalseAccept any server certificate (internal servers with a self-signed certificate); keep false for public servers
--authtypeone of password, oauth2, noneWith --smtp: password: sign in with the credential or --username/--password; none: send without signing in (relays); oauth2: Microsoft 365 sign-in with an app registration (IMAP.AccessAsApp / SMTP.SendAsApp), for mailboxes where password sign-in is switched off. When not set: password when --credential or --username is set, otherwise none
--tenanttextoauth2: the Microsoft 365 directory, e.g. contoso.onmicrosoft.com or its id
--mailboxtextoauth2: the address whose mailbox is used (send: the --from address when empty)
--action:read

Messages of a folder, newest first, as a list of records (Id, From, FromName, To, Cc, Subject, Date, Body, HtmlBody, IsRead, Attachments).

ParameterValueDefaultDescription
--server requiredtextIMAP server, e.g. imap.gmail.com or outlook.office365.com
--portnumber993993 for TLS (usual), 143 for STARTTLS or unencrypted
--vaulttextVault that holds the mail account (Vaults page); --credential is then the name of the credential in it
--credentialany valueThe mail account: the name of a credential in --vault (its user name and password, kept on the Vaults page), or a credential variable ($cred$). Gmail, Outlook.com and Yahoo need an app password; with --authtype:oauth2 the credential is the app registration (client id / client secret). Or type in --username and --password instead
--usernametextThe user name of the mail account (usually its address), typed in instead of --credential; with --authtype:oauth2 the client id of the app registration
--passwordtextThe password (or app password) for --username. It is stored in the task as plain text: prefer a vault credential (--vault, --credential)
--securityone of auto, ssl, starttls, noneautoauto: TLS on ports 465/993, STARTTLS when the server offers it on other ports (a password is never sent unencrypted); ssl: TLS from the start; starttls: must switch to TLS; none: unencrypted (internal servers only)
--ssltrue / falseOlder form of --security: false = none, true = TLS or STARTTLS (--security wins when both are set)
--timeoutnumber60Seconds to wait for the mail server before giving up
--ignoresslerrorstrue / falsefalseAccept any server certificate (internal servers with a self-signed certificate); keep false for public servers
--authtypeone of password, oauth2passwordoauth2: Microsoft 365 sign-in with an app registration (IMAP.AccessAsApp / SMTP.SendAsApp), for mailboxes where password sign-in is switched off
--tenanttextoauth2: the Microsoft 365 directory, e.g. contoso.onmicrosoft.com or its id
--mailboxtextoauth2: the address whose mailbox is used (send: the --from address when empty)
--foldertextINBOXMail folder, e.g. INBOX or Processed (mail --action:folders lists them)
--unreadtrue / falsetrueOnly unread messages
--fromtextOnly messages whose sender contains this
--totextOnly messages whose recipients contain this
--subjecttextOnly messages whose subject contains this
--bodytextOnly messages whose text contains this
--sinceany valueOnly messages received on or after this date
--beforeany valueOnly messages received before this date
--hasattachmentstrue / falsetrue: only messages with attachments; false: only messages without
--maxnumber50At most this many messages
--markreadtrue / falsefalseMark the returned messages as read
--output requiredvariable nameVariable that receives the result
--action:count

Number of messages in a folder that match the same filters as read (default: the unread ones).

ParameterValueDefaultDescription
--server requiredtextIMAP server, e.g. imap.gmail.com or outlook.office365.com
--portnumber993993 for TLS (usual), 143 for STARTTLS or unencrypted
--vaulttextVault that holds the mail account (Vaults page); --credential is then the name of the credential in it
--credentialany valueThe mail account: the name of a credential in --vault (its user name and password, kept on the Vaults page), or a credential variable ($cred$). Gmail, Outlook.com and Yahoo need an app password; with --authtype:oauth2 the credential is the app registration (client id / client secret). Or type in --username and --password instead
--usernametextThe user name of the mail account (usually its address), typed in instead of --credential; with --authtype:oauth2 the client id of the app registration
--passwordtextThe password (or app password) for --username. It is stored in the task as plain text: prefer a vault credential (--vault, --credential)
--securityone of auto, ssl, starttls, noneautoauto: TLS on ports 465/993, STARTTLS when the server offers it on other ports (a password is never sent unencrypted); ssl: TLS from the start; starttls: must switch to TLS; none: unencrypted (internal servers only)
--ssltrue / falseOlder form of --security: false = none, true = TLS or STARTTLS (--security wins when both are set)
--timeoutnumber60Seconds to wait for the mail server before giving up
--ignoresslerrorstrue / falsefalseAccept any server certificate (internal servers with a self-signed certificate); keep false for public servers
--authtypeone of password, oauth2passwordoauth2: Microsoft 365 sign-in with an app registration (IMAP.AccessAsApp / SMTP.SendAsApp), for mailboxes where password sign-in is switched off
--tenanttextoauth2: the Microsoft 365 directory, e.g. contoso.onmicrosoft.com or its id
--mailboxtextoauth2: the address whose mailbox is used (send: the --from address when empty)
--foldertextINBOXMail folder, e.g. INBOX or Processed (mail --action:folders lists them)
--unreadtrue / falsetrueOnly unread messages
--fromtextOnly messages whose sender contains this
--totextOnly messages whose recipients contain this
--subjecttextOnly messages whose subject contains this
--bodytextOnly messages whose text contains this
--sinceany valueOnly messages received on or after this date
--beforeany valueOnly messages received before this date
--hasattachmentstrue / falsetrue: only messages with attachments; false: only messages without
--output requiredvariable nameVariable that receives the result
--action:folders

The full names of the mail folders of the account (e.g. INBOX, Archive/2024), as a list.

ParameterValueDefaultDescription
--server requiredtextIMAP server, e.g. imap.gmail.com or outlook.office365.com
--portnumber993993 for TLS (usual), 143 for STARTTLS or unencrypted
--vaulttextVault that holds the mail account (Vaults page); --credential is then the name of the credential in it
--credentialany valueThe mail account: the name of a credential in --vault (its user name and password, kept on the Vaults page), or a credential variable ($cred$). Gmail, Outlook.com and Yahoo need an app password; with --authtype:oauth2 the credential is the app registration (client id / client secret). Or type in --username and --password instead
--usernametextThe user name of the mail account (usually its address), typed in instead of --credential; with --authtype:oauth2 the client id of the app registration
--passwordtextThe password (or app password) for --username. It is stored in the task as plain text: prefer a vault credential (--vault, --credential)
--securityone of auto, ssl, starttls, noneautoauto: TLS on ports 465/993, STARTTLS when the server offers it on other ports (a password is never sent unencrypted); ssl: TLS from the start; starttls: must switch to TLS; none: unencrypted (internal servers only)
--ssltrue / falseOlder form of --security: false = none, true = TLS or STARTTLS (--security wins when both are set)
--timeoutnumber60Seconds to wait for the mail server before giving up
--ignoresslerrorstrue / falsefalseAccept any server certificate (internal servers with a self-signed certificate); keep false for public servers
--authtypeone of password, oauth2passwordoauth2: Microsoft 365 sign-in with an app registration (IMAP.AccessAsApp / SMTP.SendAsApp), for mailboxes where password sign-in is switched off
--tenanttextoauth2: the Microsoft 365 directory, e.g. contoso.onmicrosoft.com or its id
--mailboxtextoauth2: the address whose mailbox is used (send: the --from address when empty)
--output requiredvariable nameVariable that receives the result
--action:saveattachments

Saves the attachments of a message into a folder; --output receives the list of files.

ParameterValueDefaultDescription
--server requiredtextIMAP server, e.g. imap.gmail.com or outlook.office365.com
--portnumber993993 for TLS (usual), 143 for STARTTLS or unencrypted
--vaulttextVault that holds the mail account (Vaults page); --credential is then the name of the credential in it
--credentialany valueThe mail account: the name of a credential in --vault (its user name and password, kept on the Vaults page), or a credential variable ($cred$). Gmail, Outlook.com and Yahoo need an app password; with --authtype:oauth2 the credential is the app registration (client id / client secret). Or type in --username and --password instead
--usernametextThe user name of the mail account (usually its address), typed in instead of --credential; with --authtype:oauth2 the client id of the app registration
--passwordtextThe password (or app password) for --username. It is stored in the task as plain text: prefer a vault credential (--vault, --credential)
--securityone of auto, ssl, starttls, noneautoauto: TLS on ports 465/993, STARTTLS when the server offers it on other ports (a password is never sent unencrypted); ssl: TLS from the start; starttls: must switch to TLS; none: unencrypted (internal servers only)
--ssltrue / falseOlder form of --security: false = none, true = TLS or STARTTLS (--security wins when both are set)
--timeoutnumber60Seconds to wait for the mail server before giving up
--ignoresslerrorstrue / falsefalseAccept any server certificate (internal servers with a self-signed certificate); keep false for public servers
--authtypeone of password, oauth2passwordoauth2: Microsoft 365 sign-in with an app registration (IMAP.AccessAsApp / SMTP.SendAsApp), for mailboxes where password sign-in is switched off
--tenanttextoauth2: the Microsoft 365 directory, e.g. contoso.onmicrosoft.com or its id
--mailboxtextoauth2: the address whose mailbox is used (send: the --from address when empty)
--foldertextINBOXMail folder, e.g. INBOX or Processed (mail --action:folders lists them)
--id requiredany valueId of a message from mail read, e.g. $message.Id$ (valid in the folder it was read from)
--destination requiredtextFolder for the files (existing files are kept; a number is added to the name) A folder on the agent machine.
--filtertext*File name pattern, e.g. *.pdf
--outputvariable nameVariable that receives the result
--action:move
ParameterValueDefaultDescription
--server requiredtextIMAP server, e.g. imap.gmail.com or outlook.office365.com
--portnumber993993 for TLS (usual), 143 for STARTTLS or unencrypted
--vaulttextVault that holds the mail account (Vaults page); --credential is then the name of the credential in it
--credentialany valueThe mail account: the name of a credential in --vault (its user name and password, kept on the Vaults page), or a credential variable ($cred$). Gmail, Outlook.com and Yahoo need an app password; with --authtype:oauth2 the credential is the app registration (client id / client secret). Or type in --username and --password instead
--usernametextThe user name of the mail account (usually its address), typed in instead of --credential; with --authtype:oauth2 the client id of the app registration
--passwordtextThe password (or app password) for --username. It is stored in the task as plain text: prefer a vault credential (--vault, --credential)
--securityone of auto, ssl, starttls, noneautoauto: TLS on ports 465/993, STARTTLS when the server offers it on other ports (a password is never sent unencrypted); ssl: TLS from the start; starttls: must switch to TLS; none: unencrypted (internal servers only)
--ssltrue / falseOlder form of --security: false = none, true = TLS or STARTTLS (--security wins when both are set)
--timeoutnumber60Seconds to wait for the mail server before giving up
--ignoresslerrorstrue / falsefalseAccept any server certificate (internal servers with a self-signed certificate); keep false for public servers
--authtypeone of password, oauth2passwordoauth2: Microsoft 365 sign-in with an app registration (IMAP.AccessAsApp / SMTP.SendAsApp), for mailboxes where password sign-in is switched off
--tenanttextoauth2: the Microsoft 365 directory, e.g. contoso.onmicrosoft.com or its id
--mailboxtextoauth2: the address whose mailbox is used (send: the --from address when empty)
--foldertextINBOXMail folder, e.g. INBOX or Processed (mail --action:folders lists them)
--id requiredany valueId of a message from mail read, e.g. $message.Id$ (valid in the folder it was read from)
--target requiredtextMail folder to move the message to, e.g. Processed
--action:delete
ParameterValueDefaultDescription
--server requiredtextIMAP server, e.g. imap.gmail.com or outlook.office365.com
--portnumber993993 for TLS (usual), 143 for STARTTLS or unencrypted
--vaulttextVault that holds the mail account (Vaults page); --credential is then the name of the credential in it
--credentialany valueThe mail account: the name of a credential in --vault (its user name and password, kept on the Vaults page), or a credential variable ($cred$). Gmail, Outlook.com and Yahoo need an app password; with --authtype:oauth2 the credential is the app registration (client id / client secret). Or type in --username and --password instead
--usernametextThe user name of the mail account (usually its address), typed in instead of --credential; with --authtype:oauth2 the client id of the app registration
--passwordtextThe password (or app password) for --username. It is stored in the task as plain text: prefer a vault credential (--vault, --credential)
--securityone of auto, ssl, starttls, noneautoauto: TLS on ports 465/993, STARTTLS when the server offers it on other ports (a password is never sent unencrypted); ssl: TLS from the start; starttls: must switch to TLS; none: unencrypted (internal servers only)
--ssltrue / falseOlder form of --security: false = none, true = TLS or STARTTLS (--security wins when both are set)
--timeoutnumber60Seconds to wait for the mail server before giving up
--ignoresslerrorstrue / falsefalseAccept any server certificate (internal servers with a self-signed certificate); keep false for public servers
--authtypeone of password, oauth2passwordoauth2: Microsoft 365 sign-in with an app registration (IMAP.AccessAsApp / SMTP.SendAsApp), for mailboxes where password sign-in is switched off
--tenanttextoauth2: the Microsoft 365 directory, e.g. contoso.onmicrosoft.com or its id
--mailboxtextoauth2: the address whose mailbox is used (send: the --from address when empty)
--foldertextINBOXMail folder, e.g. INBOX or Processed (mail --action:folders lists them)
--id requiredany valueId of a message from mail read, e.g. $message.Id$ (valid in the folder it was read from)
--action:markread
ParameterValueDefaultDescription
--server requiredtextIMAP server, e.g. imap.gmail.com or outlook.office365.com
--portnumber993993 for TLS (usual), 143 for STARTTLS or unencrypted
--vaulttextVault that holds the mail account (Vaults page); --credential is then the name of the credential in it
--credentialany valueThe mail account: the name of a credential in --vault (its user name and password, kept on the Vaults page), or a credential variable ($cred$). Gmail, Outlook.com and Yahoo need an app password; with --authtype:oauth2 the credential is the app registration (client id / client secret). Or type in --username and --password instead
--usernametextThe user name of the mail account (usually its address), typed in instead of --credential; with --authtype:oauth2 the client id of the app registration
--passwordtextThe password (or app password) for --username. It is stored in the task as plain text: prefer a vault credential (--vault, --credential)
--securityone of auto, ssl, starttls, noneautoauto: TLS on ports 465/993, STARTTLS when the server offers it on other ports (a password is never sent unencrypted); ssl: TLS from the start; starttls: must switch to TLS; none: unencrypted (internal servers only)
--ssltrue / falseOlder form of --security: false = none, true = TLS or STARTTLS (--security wins when both are set)
--timeoutnumber60Seconds to wait for the mail server before giving up
--ignoresslerrorstrue / falsefalseAccept any server certificate (internal servers with a self-signed certificate); keep false for public servers
--authtypeone of password, oauth2passwordoauth2: Microsoft 365 sign-in with an app registration (IMAP.AccessAsApp / SMTP.SendAsApp), for mailboxes where password sign-in is switched off
--tenanttextoauth2: the Microsoft 365 directory, e.g. contoso.onmicrosoft.com or its id
--mailboxtextoauth2: the address whose mailbox is used (send: the --from address when empty)
--foldertextINBOXMail folder, e.g. INBOX or Processed (mail --action:folders lists them)
--id requiredany valueId of a message from mail read, e.g. $message.Id$ (valid in the folder it was read from)
--readtrue / falsetruefalse marks the message as unread

Examples

mail --action:send --smtp:"smtp.gmail.com" --port:587 --vault:"Mail" --credential:"Robot mailbox" --from:"bot@company.com" --to:"admin@company.com" --cc:"manager@company.com" --subject:"RPA Report" --body:$reportContent$ --bodytype:html --attachment:"C:\report.pdf"
mail --action:send --to:"team@company.com; boss@company.com" --subject:"Done" --body:"All invoices are booked" --attachment:"C:\report.pdf"
mail --action:send --smtp:"mail.company.com" --port:465 --username:"robot@company.com" --password:"app-password" --from:"robot@company.com" --to:"admin@company.com" --replyto:"help@company.com" --priority:high --subject:"Test" --body:"Typed-in account"
mail --action:read --server:"imap.gmail.com" --vault:"Mail" --credential:"Robot mailbox" --subject:"Invoice" --since:$yesterday$ --hasattachments:true --max:20 --output:messages
mail --action:count --server:"imap.gmail.com" --vault:"Mail" --credential:"Robot mailbox" --output:unreadCount
mail --action:folders --server:"imap.gmail.com" --vault:"Mail" --credential:"Robot mailbox" --output:folders
mail --action:saveattachments --server:"imap.gmail.com" --credential:$mailCred$ --id:$message.Id$ --destination:"C:\Inbox" --filter:"*.pdf" --output:files
mail --action:move --server:"imap.gmail.com" --credential:$mailCred$ --id:$message.Id$ --target:"Processed"
mail --action:markread --server:"imap.gmail.com" --credential:$mailCred$ --id:$message.Id$
mail --action:delete --server:"imap.gmail.com" --credential:$mailCred$ --id:$message.Id$

restapi REST API

Makes an HTTP request; the response is stored as a record variable.

Parameters of every variant

ParameterValueDefaultDescription
--url requiredtext
--querytextQuery string as comma-separated name=value pairs, e.g. page=1,search=$term$ (URL-encoded for you)
--headerstextComma-separated Key=Value pairs
--bodyany value
--bodytypeone of json, xml, text, formdata, urlencodedjson
--filetextFile to upload (formdata) A file on the agent machine.
--savetotextDownload: save the response to this file instead of reading it (the record then has File; an error answer stays in Body) A file on the agent machine.
--credential$variable$
--authtypeone of basic, bearer, apikey
--apikeytextX-API-KeyAPI key header name
--outputvariable nameVariable that receives the result
--timeoutnumber30Timeout in seconds
--retrynumberNumber of retry attempts. When not set, screen and file commands try once more after a passing problem (a page still loading, a covered element, a locked file); 0 turns that off
--retryintervalnumber1Seconds between retries
--followredirectstrue / falsetrue
--ignoresslerrorstrue / falsefalse

Actions (--action)

--action:get

No further parameters.

--action:post

No further parameters.

--action:put

No further parameters.

--action:delete

No further parameters.

--action:patch

No further parameters.

--action:head

No further parameters.

--action:options

No further parameters.

Examples

restapi --action:get --url:"https://api.example.com/orders" --query:"status=open,page=1" --output:response
json --action:getvalue --source:$response.Json$ --path:"data.orders[0].customer.name" --output:name
restapi --action:get --url:"https://api.example.com/users" --headers:"Content-Type=application/json,Authorization=Bearer $token$" --output:response
restapi --action:post --url:"https://api.example.com/users" --headers:"Content-Type=application/json" --body:$jsonBody$ --output:response
restapi --action:put --url:"https://api.example.com/users/1" --headers:"Content-Type=application/json" --body:$updateData$ --output:response
restapi --action:delete --url:"https://api.example.com/users/1" --headers:"Authorization=Bearer $token$" --output:response
restapi --action:patch --url:"https://api.example.com/users/1" --headers:"Content-Type=application/json" --body:$patchData$ --output:response
restapi --action:post --url:"https://api.example.com/upload" --bodytype:formdata --file:"C:\report.pdf" --output:response
restapi --action:post --url:"https://secure-api.com/data" --credential:$apiCred$ --authtype:basic --body:$payload$ --output:response
Botream 0.1.16 · Generated 2026-11-06