API: Automate import contact and send program
Dropthought APIs facilitate smooth automation of adding a contact and triggering a program based on the point of trigger.
This article will help you understand:
What are the available APIs?
When can you use these APIs?
What are the prerequisites for using these APIs?
How to best utilize Dropthought features while using the API approach?
Scenario:
Below are some of the scenarios where you can make use of the APIs and automate adding a contact and triggering a program (survey)
You have an online shopping platform and want to trigger a feedback survey upon every purchase.
For a service-based business, you want to send a feedback survey to gather client satisfaction after completing a project.
You want to set up an automation to send out a satisfaction survey to clients upon closing their support ticket.
If you run a hospitality business, you want to send a feedback survey to guests soon after their stay to gather their experience and suggestions.
In the case of e-learning platforms, you want to gather student feedback upon a course or module completion.
Pre-requisites:
Please ensure that all the below prerequisites are covered before running the API for creating a contact and triggering a survey
A valid Dropthought account and the user should have Admin access. The email address should be registered as a user in Dropthought to proceed with authentication.
An active program.
A list (distribution list) with required metadata. The list should be added to the program’s distribution list. Please note that you cannot add an empty list to a program. Hence, add a dummy contact.
Schedule the program using advanced scheduling. The feature has to be enabled from the backend; please contact the CS team.
Valid access token and refresh token to establish your platform and Dropthought integration. These are time sensitive and have an expiry period of 1 hour and 24 hours, respectively. Refer to the next section to generate access and refresh tokens.
Contact the CS team to fetch your participant group identifier to use the APIs for adding a contact and triggering a program.
Step #1: Authentication: Generating Access and Refresh Tokens
Upon creating an account with Dropthought, the CS team will share your credentialsThese are required for authentication, and you will get access to the APIs.
Endpoint: POST /api/authenticate/login
Path Parameters: No Parameters
Query Parameters: No Parameters
Request fields
Path | Type | Optional | Description |
String | false | the email account of the registered user | |
password | String | false | the password associated with the registered email in the platform |
Response fields
Path | Type | Description |
result.accessToken | string | token to be used in the header as authorization bearer for API |
result.refreshToken | string | token to renew the access token |
success | boolean | true (or) false |
Example Request
curl -X POST 'https://{environment}-api.dropthought.com/dtapp/api/authenticate/login' \
-H 'Content-Type: application/json' \
-d '{"email": "{email}", "password": "{password}"'
Where {email} is to be replaced with the registered email address and {password} is to be replaced with the associated password.
Example Response
{
"result": {
"accessToken": "abcdefZYXg",
"refreshToken": "abcdefZYXgwerwe"
},
"success": true
}
Step #2: Program and List on Dropthought
Upon authentication, you can create the program and associate a list.
The API approach works best with advanced scheduling. You can use email and SMS channels to trigger the program link for the new contact.
Create a program on Dropthought.
Create a list and add the required metadata. Please ensure that you have at least one metadata of date-time type.
Navigate to the program’s Distribution tab:
Add the list created.
Go to advanced scheduling. If you cannot find this feature, please contact the CS team. This is recommended approach, as you can trigger the program every time a new contact comes into your platform and push to Dropthought.
Set up email content. Further, you can set up the first and second reminder emails from here.
You can set up the message body to trigger the program link via SMS. Please ensure that you have added metadata of phone number type on the list. The phone number should have a country code as the prefix.
Publish the program.
Step #3: Adding Contact and Triggering Program
Please contact the CS team to fetch your participant group identifier. Further, below are the APIs to add a contact from your system and trigger a survey for the respective contact.
Note:
The attributes of headers are based on the metadata you have added to the list.
The data and CURL commands will follow the above condition.
Endpoint:
POST https://api.dropthought.com/dtapp/api/participant/?participantgroupuuid=dddd
Request Headers:
{
"Accept": "application/json",
"Authorization": "Bearer << access from login API's response>>"
}
Request Body:
{
"header": [
"Account Number",
"Customer Name",
"Customer Email",
"Customer Contact No",
"Login ID",
"User Name",
"Interaction ID",
"Closed Date",
"Ticket Source",
"Ticket Type",
"Service Category",
"Service Type",
"Problem Type",
"Role",
"Location",
"Created date",
"Closed by"
],
"data": [
"DST1234",
"Sudhakar",
"sudhakar1@dropthought.com",
"+6738699729",
"Ag566879",
"Agent 2",
"INQ4576",
"2023-01-01 14:00:00",
"Email",
"MR",
"Mobi",
"Fixed",
"Billing Relared",
"152 Agent",
"Test Location",
"2022-01-01 14:00:00",
"Test User"
]
}
Sample CURL:
curl --location 'https://api.dropthought.com/dtapp/api/participant/?participantgroupuuid=dddd' \
--header 'Authorization: Bearer eyJraWQiOiJ5N0RzeU82bGd6eU40aC1OMkVVUGtWT0p2LTNaSEY2bE55Z3dQSVh3b29nIiwiYWxnIjoiUlMyNTYifQ. Yf6zXtiZ0eDB6hSGaLYpaeBoNhh9AnzS-GDg' \
--header 'Content-Type: application/json' \
--data-raw '{
"header": [
"Account Number",
"Customer Name",
"Customer Email",
"Customer Contact No",
"Login ID",
"User Name",
"Interaction ID",
"Closed Date",
"Ticket Source",
"Ticket Type",
"Service Category",
"Service Type",
"Problem Type",
"Role",
"Location",
"Created date",
"Closed by"
],
"data": [
"DST1234",
"Sudhakar",
"sudhakar1@dropthought.com",
"+6738699729",
"Ag566879",
"Agent 2",
"INQ4576",
"2023-01-01 14:00:00",
"Email",
"MR",
"Mobi",
"Fixed",
"Billing Relared",
"152 Agent",
"Test Location",
"2022-01-01 14:00:00",
"Test User"
]
}'
Sample Response:
{
"result": [
{
"created_time": "2023-03-07 10:51:02.0",
"data": "[\"DST1234\", \"Sudhakar\", \"sudhakar1@dropthought.com\", \"+6738699729\", \"Ag566879\", \"Agent 2\", \"INQ4576\", \"2023-01-01 14:00:00\", \"Email\", \"MR\", \"Mobi\", \"Fixed\", \"Billing Relared\", \"152 Agent\", \"Test Location\", \"2022-01-01 14:00:00\", \"Test User\", \"\"]",
"meta_data": "[\"String\", \"NAME\", \"EMAIL\", \"PHONE\", \"String\", \"String\", \"String\", \"DATE\", \"String\", \"String\", \"String\", \"String\", \"String\", \"String\", \"String\", \"DATE\", \"String\", \"STRING\"]",
"header": "[\"Account Number\", \"Customer Name\", \"Customer Email\", \"Customer Contact No\", \"Login ID\", \"User Name\", \"Interaction ID\", \"Closed Date\", \"Ticket Source\", \"Ticket Type\", \"Service Category\", \"Service Type\", \"Problem Type\", \"Role\", \"Location\", \"Created date\", \"Closed by\", \"Primary Key\"]",
"phi_data": "[false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false]",
"id": 4,
"primary_key": "Sudhakarsudhakar1@dropthought.com",
"created_by": 718,
"participant_uuid": "e29272f4-f572-421f-8662-58428a2cba47"
}
],
"success": true
}
Dropthought Tips
Here are some tips to help you use the platform to its best:
Improve response rate by setting program reminders and personalized messages using tags.
Utilize advanced scheduling capabilities to automate program triggers instantly or within a specific time interval.
Consider selecting "Use this response as metadata" for open-ended or single-response questions. Choose the suitable data type that matches the information you want to collect. Thus, you can enhance the filtering out of the insights derived from your program and efficiently categorize respondents based on the metadata collected.
Metadata questions are recommended for programs without a predefined list of respondents.Analyze responses received using Text Analytics and Segments. Find improvement areas and response trends to strategize further steps to improve.
Enable response-triggered notifications, workflows, or webhooks using Triggers. It can be set up based on a respondent's activity or specific to a program.
