Automatically Post Notifications to Zinc
This recipe shows you how to configure an HTTP Data Destination A Data Destination specifies where to send data from a submitted form. You can use Data Destinations to automate data sharing and storage, routing data to a specific service (such as email or cloud storage) in several different formats. and a Handlebars Document to automate Zinc notifications. When a front-line worker submits a form successfully, TrueContext sends a message to people, groups, bots, or hotlines in Zinc.
To support existing integrations, some items will continue to use “prontoforms” or “pf” in the domain or code.
For more detailed information about what’s changing, visit https://support.truecontext.com/hc/en-us/articles/19516168513556
Available on the Advanced and Enterprise tiers:
Prerequisites
-
In your Zinc app, create a bot or a hotline group in your Official Group.
-
Take note of the Bot Identification Token or Integration Token associated with your bot or hotline. You will need them for the Data Destination configuration.
-
Bot Identification Token—characters preceding @bots.zincit.io
-
Integration Token—characters preceding @hotlines.zincit.io
The following example shows a Bot Identification Token and an Integration Token.
-
Scenario
When front-line workers are in the field, they often use Zinc to communicate with other people in the organization. You might want to automate the flow of information from the front-line workers to their supervisors. For example, you can post an automated Zinc notification when a front-line worker completes a work order.
The TrueContext HTTP Data Destination can connect with the Zinc Messaging API to programmatically send updates from the field to people, groups, bots, or hotlines in Zinc.
Steps to post notifications to Zinc
-
Create a Handlebars Document in JSON format.
Template-driven text documents such as Handlebars provide you with ways to build your own data structure, and export data as any file type.
-
Configure the Document Basics tab as needed.
Info: The topic Handlebars Document shows how to create a Handlebars Document Template.
-
On the Configuration tab, select the data structure, select the file extension, and enter the request body as shown in this example:
In this example, the Handlebars Template is:
{ "body": "A Work Order has been completed: {{ answers.WorkOrderNumber.[0]}}. \n View Work Order in ServiceMax - https://na136.salesforce.com/{{answers.RecordID.[0]}}. \n View Service Report in ProntoForms - https://live.prontoforms.com/data/{{dataRecord.identifier}}.pdf " }
The following table describes the body structure.
Part Purpose A Work Order has been completed:
This static string indicates that the work is complete. {{ answers.WorkOrderNumber.[0]}}
This expression provides a dynamic reference to the Work Order Number using WorkOrderNumber—a TrueContext question Unique Identifier.
Note:Make sure your form has a text question with the Unique Identifier WorkOrderNumber. This question can be prepopulated using an App‑to‑App request or a Salesforce Data Source.
View Work Order in ServiceMax - https://example.salesforce.com
This static string references the ServiceMax org where you can view the Work Order.
Note:Make sure you replace the example URL with your org URL.
{{answers.RecordID.[0]}}
This expression provides a dynamic reference to the ServiceMax Record ID using RecordID—a TrueContext Unique Identifier.
Note:Make sure your form has a text question with the Unique Identifier RecordID. This question can be prepopulated using an App‑to‑App request or a Salesforce Data Source.
View Service Report in TrueContext - https://live.prontoforms.com/data/{{dataRecord.identifier}}.pdf
This combination of a static string and an expression enables the Zinc users to view the TrueContext form submission document. -
Select Create.
Result: The system creates a Handlebars document that you can link to your form.
-
-
Create an HTTP Data Destination.
-
On the Connection tab, name your connection, enter the Base Connection URL https://api.zincit.io, and then select Anonymous Access:
-
On the Request Configuration tab, select the POST HTTP Method, and then enter the URL Suffix hooks/v1/:id/message. Replace the URL Suffix“:id” with your Bot Identification Token, or Integration Token:
-
Configure the Destination Basics, Filtering and Response Configuration tabs as needed.
Info:The topic HTTP Data Destination shows how to configure an HTTP Data Destination.
-
Select Create.
Result: The system creates an HTTP Data Destination that you can link to your form.
-
-
Link the Data Destination and the Document you configured to your form.
-
Save and deploy your form.
Result: When a front-line worker submits the form, TrueContext sends a Zinc notification as shown in the following example:
Variations of this recipe
You can use variations of the JSON request body to send different messages to Zinc.
When you want to… | Use a request body like… |
---|---|
Hard-code a message | { "body": "Work order closed" } |
Send specific form answers using DREL![]() |
{ "body": "%a[QuestionLabel]" } |
Send a direct message to a Zinc user | { "recipients": ["address@example.com"], "body": "hello world." } |
Send a direct message to a Zinc user using DREL | { "recipients": ["%u[email]"], "body": "Work order closed" } |