Methods
The following methods are available to you when writing your inbox app.Global methods: Methods available globally in the script.
Method | Arguments | Returns | Description |
---|---|---|---|
debug | string s | — |
|
forward new | email request | — | A simple method to forward the incoming email to other recipients. Fully supports text, html, attachments, and embedded images. |
get | string url | Http Response | Simple Http get request to the specified url |
get | Simple Http Request | Http Response | “” |
httpDelete | string url | Http Response | Simple Http delete request to the specified url (Javascript already has a delete method.) |
httpDelete | Simple Http Request | Http Response | “” |
patch | Http Request | Http Response | Http patch request to the specified url. |
post | Http Request | Http Response | Http post request to the specified url. See the post files code snippet for details on how to post files to a site. |
put | Http Request | Http Response | Http put request to the specified url. |
reply | string subject, string body |
— | A simpler version of sendMail with the to argument set to the author of the incoming email. |
sendEmail new | email request | — | A robust method to send emails exactly how you would like — text, html, to/cc/bcc, attachments, and embedded images. |
sendMail | string to, string subject, string body |
— | A simplified sendEmail method — Send a text email to the email address specified. |
sendDisconnectEmail | — | — | Sends an email to the end user to clear any authentication we have stored. There is only one Obindo email sent for disconnecting, and it contains a link to a form where the user can disassociate from your script (or any others). |
Simple Http Request | Http Request | Http Response |
---|---|---|
{
|
{
|
{
|
sendEmail | forward |
---|---|
{
|
{
(no need to worry about text, html, or files — we take care of those!) |
Accepted email lists:
Posting files is the same as posting them as arguments on an HTTP post. can be as easy as setting the email files to the files of the incoming message:
... or you can also get creative and construct files on the fly:
|
Method | Arguments | Returns | Description |
---|---|---|---|
getAuthRedirectUrl | string url | — | Stub to be overwritten. Return the url of the remote site on which the user will authenticate access to your script. Possibly this also includes setting the tokens.requestToken object. |
getCallbackUrl | bool isFixedUrl (optional, defaults to false) | string url | Returns the Obindo url which will process the redirect from the remote site after the end user authorizes your script. Often must be passed to the remote site in the querystring. If the redirect url must be set when registering for OAuth 2 on the remote site, isFixedUrl must be set to true. See the Fixed Url code snippet for more details. |
onAuthResponse | string querystring | — | Stub to be overwritten. Called after the remote site redirects the end user back to Obindo after he or she authorizes access to your script. Typically, you will take the values from the querystring and use them to set the tokens.accessToken. |
refreshAccessToken | — | — | Called when the access token for the end user has expired and needs to be refreshed. Must reset the tokens.accessToken object. |
use | string appName | — | Use another app's OAuth2 workflow so you don't have to rewrite it in your app! The only code you'll need to write is what to do with an email once the user is successfully authenticated. Note: You can only use the OAuth2 workflow of apps you have written. |
The methods getId, loadFromEmailAddress, and loadFromId are necessary only if the remote site requires one url to redirect the user to after authorization. See the Fixed Url code snippet for more details.
Method/Parameter | Arguments | Returns | Description |
---|---|---|---|
accessToken | (property) | (property) | An object to store all values returned when retrieving a user's access token. Typically this is initially set in oauth2.onAuthResponse and possible reset in oauth2.refreshAccessToken |
getId | — | string id | Return the unique id of the end user's token for your script. |
loadFromEmailAddress | string emailAddress | — | Set the tokens object based on the end user's email address. |
loadFromId | string id | — | Set the tokens object based on the unique id of the user's token. |
requestToken | (property) | (property) | An object to store all values returned when retrieving a user's request token. Typically this is initially set in oauth2.getAuthRedirectUrl and used again in oauth2.onAuthResponse, though it may not always be necessary. |
Method/Parameter | Arguments | Returns | Description |
---|---|---|---|
aliasOf | string appName | — | Want more than one email address to do the same thing? Write a one line app: settings.aliasOf('<originalApp>'); Note: You can only create an alias of apps you have written. |
Method | Arguments | Returns | Description |
---|---|---|---|
getDates | string | array of dates | Use our parsers to get the dates found in the text passed in. Time zones optimized for the email being processed. Also useful for your own text, such as util.getDates('tomorrow'); |
getHeaderArgsFromObject | obj | string | Builds a set of arguments to be passed in a Http request header from a json object.(a="1", b= "2") |
getObjectFromQueryArgs | string qs | obj | Builds a json object from a string in querystring format (a=1&b=2). |
getNonce | — | long | Returns a nonce (arbitrary number used once; actually just a timestamp). |
getQueryArgsFromObject(o) | obj | string | Build a string in querystring format from a json object. |
getTags | string s | string[] | From a string, return a list of tags (noise words removed). |
getTimeStamp | — | long | Returns a timestamp. |
jsonify(string) | string | obj | Builds a json object from a string in json format. |
stringify(o) | — | string | Builds a string in json format from a json object. |
urlEncode | string s | string | Returns a url encoded version of the string passed in. |