Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
Email Endpoints are available in PhixFlow version 11.3+
What is an
APIEmail Endpoint?
Excerpt-include | ||||||
---|---|---|---|---|---|---|
|
|
How does an Email Endpoint work?
- An Email Account must be set up in your application to receive incoming emails. See Email Account Integrationfor an example.
- The email account setup must include:
- Type: choose Inbound
- On Email Received: choose Trigger an email endpoint actionflow
- Email Endpoint Action: choose your
Insert excerpt _
- The email account setup must include:
email_
endpoint _
email_
endpoint
nopanel true
- To save the emails, a
Insert excerpt _tables _tables nopanel true
- must be created with appropriate attributes for the headers on the incoming emails, e.g. id, from, to, cc, subject, body, folderId
- To allow PhixFlow to save attachments, a
Insert excerpt _
tableFile _
tableFile nopanel true
- must be created
- The above Table and File Table must have a relation on an ERD, see Relationship
- Upon receiving an email, the
Insert excerpt _
email_endpoint _
email_endpoint nopanel true
name | FullPage |
---|
Creating an API Endpoint
API- will run and perform the action(s) as specified within the Email Endpoint Actionflow, such as saving each incoming email as a record in a table
- If saving to a table, each received email saves as a separate record
Creating an Email Endpoint
a setEmail endpoints must be made using the specific option on the
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Iframe | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
ensure the set of predefined input parameters are configured on the
incoming connection point.
incoming connection point. Insert excerpt _input _input name icon nopanel true
- Create a new
Insert excerpt _
email_
endpoint _
email_endpoint
on thenopanel true Insert excerpt _actionflow _actionflow nopanel true
- homepage using the
- Image Added option
- Image Added
- Set a unique name and provide a useful description
- Additional attributes can be added to the
Insert excerpt _
input _
input name icon nopanel true
- connection point which will obtain the value from a header with the same name on the incoming email(s)
- Note: Any '-' characters are removed from the name and the names are case insensitive
- Configure the endpoint to perform the required tasks on receiving of incoming emails, for example
- See Worked Example below for an example setup
Input Parameters
- , save all records to a
Insert excerpt _
tables _
tables nopanel true
Image Removed
On the Input Connection Point, additional Input Parameters can be created to facilitate query string parameters being passed into the API via the URL.
Click on the- , see Save Action Configuration
- If saving any of the attributes with a Type of Structured Data, a
Insert excerpt _
- If saving any of the attributes with a Type of Structured Data, a
action_
calculate _action_calculate nopanel true
- action can be used between the
Insert excerpt _
- action can be used between the
input _
input nopanel true
- and
Insert excerpt _action_
- and
save _
action_save nopanel true
If a parameter is missing then it will be marked as unavailable, unless a Default Value has been configured.
Note |
---|
If a “timeout” parameter is sent via the URL, a corresponding Input Parameter is not required on the API Endpoint. See Timeout below. |
URL & URL Alias
URL and URL Alias can be found on the API Endpoint- action
- to convert these incoming values into a format that can be saved by PhixFlow
- For each attribute, use the listToString function
- to convert these incoming values into a format that can be saved by PhixFlow
Note | |||||||||
---|---|---|---|---|---|---|---|---|---|
Email Endpoints cannot contain
Copy the URL and save it locally, to be used later when calling the API Expand | | ||||||||
| |||||||||
Parameter | Description | ||||||||
<<Server Name>> | URL of the server e.g. app.phixflow.com | ||||||||
phixflow | the name of the instance, typically this is phixflow | ||||||||
<<Application Name>> | The name of the application where the Actionflow resides. | ||||||||
<<API Name>> | The name of the API. Note: If the API Name contains a space, this is replaced with %20 | ||||||||
Insert excerpt | _property_settings | _property_settings actions, output connection points, lookups or phases.
Saving Attachments
Attachments can be saved in a separate
. Insert excerpt _tableFile _tableFile nopanel true
Choose an API Mode:
- Wait for result (Synchronous) (Default): The API waits for the results or the timeout to occur
- Note: If the timeout occurs the command is aborted
- Poll for result (Asynchronous): The API is called and a response is returned immediately including the process ID
- Subsequent API calls can be made using the process ID to fetch the status of the action
- The asynchronous mode can be thought of as “fire and forget”
Authorisation
Allow Anonymous Connections can be found on the API Endpoint- On the Email Endpoint, click
Insert excerpt _property_settings _property_settings nopanel true
If Allow Anonymous Connections is enabled:
Excerpt | ||
---|---|---|
| ||
This allows anyone with the URL for the API to call it. The audit trail records the system as running performing the API call. |
Note: Adding authorisation is covered on API Authentication and Secret Keys.
Timeout
Timeout can be found on the API EndpointSet a Timeout (optional):
Specify a maximum time in milliseconds that the API will wait for before the command is aborted
When a Timeout value is set, it overrides the default timeout, which is 60 seconds where API Mode is Synchronous and 500 milliseconds where API Mode is Asynchronous
However, if a timeout parameter has been provided in the URL calling this API, that will override both this Timeout value and the default value
API Status Check (Poll for Result)
- If calling a PhixFlow Asynchronous API only, a result will be immediately returned which includes a Process ID for that run
- The Process ID is returned on the path:
$.processId
- This can be accessed in an Output attribute using,
_result.value
- The Process ID can be used to call the following URL which will return the current state of the run:
- https://<<Server Name>>/phixflow/api/1/action/<<Application Name>>/<<Actionflow Name>>/poll/<<processID>>
Calling a PhixFlow API
HTTP Method
This is set on the- To call a PhixFlow API use the HTTP Method GET or POST:
- GET simply calls the API with data passed in the body of the request
- POST calls the URL and sends data in the body of the request. The body data is passed into the body attribute of the API as an Input Connection point
See HTTP Action Configuration.
Returned Data JSON Path
If your API has been configured to return data the path will be in the format:
$.data.<<Output Name>>
Where <<Output Name>> is the Output connection point.
Server Console Responses
The item calling the API endpoint will receive the Response from the API endpoint stating whether it has run successfully (Success) or not (Fail). Responses can be customised to return specific messages.
The response recorded in theIf you are making the call using PhixFlow the Responses can be access as follows:
- Click the Actionflow entry
- Image Removed
- In the Messages section which is opened below, double-click the lines that begin Response
- Image Removed
- Click the Message Details tab to see the response
API Endpoint Results
To see the results of the API Endpoint processing in the- Click the Actionflow entry for the API Endpoint
- In the Messages section which is opened below, double-click any of the Messages to see more details
- If you are using a debug() statement these will appear here
Failures
An API Endpoint will fail if the logic in the Actionflow fails or if the error() function is used to force a failure.
If records are passed to the API Endpoint individually a failure will only impact the specific record being processed.
Error Codes
200
- Occurs if the output of an API Endpoint is not connected
Occurs if the output is connected and a record is returned
400
Occurs if the output is connected but no record is returned
Worked Example
Here's a worked example using the Company Data (available from the Learning Centre).
In this example, we are using:
- A Company Call API screen containing a fixed drop down list of industries, a string fields for the API Status and a multi-line string field for the Results - this screen was created using the Tile with Buttons template
Tip |
---|
If you are completing this chapter as part of the Actionflow course and using a training instance, the screens have already been pre-loaded into the Actionflow Advanced Application. For this example, we'll be working on the Company Call API screen. |
Image Removed
name | example |
---|
Example 1: Passing Out Data
In this example, we'll configure an API Endpoint that passes out Company ID, Company Name and Industry data from our Companies data.
Create API Endpoint
In this example, we'll set up an API Endpoint to pass out company data.
Create a new- Name:
API Company Data
- Click Create
Expand | ||
---|---|---|
| ||
Image Removed |
Construct JSON
Create a- Name:
GetDataAndConstructJSON
Expand | ||
---|---|---|
| ||
|
JSON
Structured Data
Expression:
Code Block | ||
---|---|---|
| ||
toJson(getCo) |
Expand | ||
---|---|---|
| ||
Image Removed |
Configure the Output
Drag theMap the JSON attribute from the Calculate action to the body attribute
Example 2: Passing in Parameters
In this example, we'll retrieve data from our Companies API and pass in an industry parameter (e.g. "Telecoms") to filter the results to just companies in that industry.
API End Point Setup
On the API End Point, create aGetIndustry
- Input Expression:
in.body
- Path:
$
- Create an Output Attribute on the JSON action
- Name:
IndustryReceived
- Type:
String
- Expression:
_result.Industry
- Name:
- Name:
ByIndustry
- Filter Details: Image Removed
Call API Actionflow Setup
On the screen, Company Call API, add an Actionflow to the Call API button- Name:
Call API
POST
Body:
Code Block | ||
---|---|---|
| ||
[{
"Industry": "${in.Industry}"
}] |
Expand | ||
---|---|---|
| ||
Image Removed |
Name:
ReturnedCompanies
- Input Expression:
in.body
Path:
$.getCo
Create 2 Output Attributes on the JSON action
- Name:
CoName
- Type:
String
- Expression:
_result.1.CompanyName
- Type:
- Name:
CompanyID
- Type:
Integer
- Expression:
_result
.1.
CompanyID
- Type:
- Name:
- body
- status
- Image Removed
- Image Removed
Expand | ||
---|---|---|
| ||
Image Removed |
Testing
- On the screen, Company Call API, click the Call API button to see the results of the Actionflow
name | LogTraffic |
---|
System Console Response
On the HTTP action, Call API, the option to Log Traffic was enabled allowing the API response to be seen in the- in the toolbar to open the settings on the right
- For the full Properties list, see Email Endpoint Properties
In the Basic Settings, in the Save Attachments to field, set the File Table that incoming email attachments should be saved to
- A new
can be created by clicking theInsert excerpt _tableFile _tableFile nopanel true
icon or choose an existing table using theInsert excerpt _add_icon _add_icon nopanel true
icon or selecting from the drop down list.Insert excerpt _tableFile _tableFile name icon nopanel true - When creating a File Table to save attachments to, a folderId attribute is automatically created
- A new
Note | ||||||||
---|---|---|---|---|---|---|---|---|
If the Email Endpoint fails, any incoming attachments will still be saved to the specified If no location is specified in the Save Attachments to field, attachments will not be saved. |
Linking Emails and Attachments
The folderId attribute that is automatically created on new
s is used to link an email to its attachments. Insert excerpt _tableFile _tableFile nopanel true
- After receiving an incoming email with attachments:
- A value will generate for the folderId attribute on the
where the email records are saved for each email receivedInsert excerpt _tables _tables nopanel true - A value will generate for the folderId attribute on the
where the email attachments are saved for each email receivedInsert excerpt _tableFile _tableFile nopanel true
- A value will generate for the folderId attribute on the
Displaying Emails
HTML Comment | ||
---|---|---|
| ||
|
Emails can be displayed using a
view. Insert excerpt _grid _grid nopanel true
Worked Example
Coming Soon.
If you require further support on this topic, please contact PhixFlow Support via the
ChatBot, available in Image Added Design Mode from the system controls in the top right of PhixFlow. Insert excerpt _chat_bot _chat_bot nopanel true
On this page
Table of Contents | ||||
---|---|---|---|---|
|