Add a survey via API
Mindful Feedback provides an API to use for many functions, including adding new survey interactions. In the API, the Add New Interaction resource can be used to create a new survey interaction.
- Complete API documentation can be found at https://apidocs.surveydynamix.com. We recommend exploring the required authentication methods outlined in the early sections of the API document before proceeding.
- Interactions cannot be added if a pending interaction with the same phone number and survey ID exists, unless the _force_new parameter is set to true. If you attempt to add an interaction like this, a 409(Conflict) response will be returned.
Add New Interaction
URI: /interactions
Method: POST
Parameters:
Name | Description | Allowed Values | Default |
---|---|---|---|
survey_id |
| integer | No default; Parameter required |
_force_new | Force a new interaction to be added even if a pending interaction with the same phone number and survey ID exists. | boolean | FALSE |
phone_number |
| A 12-character string in the proper phone-number format | empty |
phone_connection_id |
| integer | empty |
| An email address | empty | |
survey_type | The survey medium to use | inbound, outbound, sms, web, email, websms | web |
scheduled_at | The time at which an outbound voice, sms, or email survey is scheduled to be sent, or the time after which an inbound survey is allowed to start. |
| now |
external_ref | A standard string field for referencing external system IDs | string | empty |
call_type | A standard string field for report aggregation | string | empty |
agent_id |
| string | empty |
respondent_language |
| see Supported Languages | determined by region |
_shorten_urls | Generate a short URL for the Start Survey link and the Unsubscribe link. | boolean | FALSE |
Custom Metadata | Parameters not otherwise listed in this table will be added as interaction data resources associated with the created interaction. | The key must only include alphanumeric characters and underscores and must start with a letter. The value may be any string. | none |
Example
The following curl request will create an email interaction scheduled five minutes from now, for respondent@example.com, using the survey with ID 52:
curl -X POST "https://surveydynamix.com/api/interactions" \
-d "survey_id=52" \
-d "survey_type=email" \
-d "email=respondent@example.com" \
-d "scheduled_at=Now + 5 minutes" \
-u Customer_UUID:Auth_Token
Example Request and Response
The following series of screenshots shows an example of creating a Web SMS survey via the Add New Interaction API resource.
Using Basic Authorization (credentials found at Customer Settings > Customer Credentials)One header added: content-type = application/json