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.

Note:
  • 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:

NameDescriptionAllowed ValuesDefault
survey_id
  • The ID of the survey you wish to use for the interaction
  • Found on the top right of the relevant survey page
integerNo default; Parameter required
_force_newForce a new interaction to be added even if a pending interaction with the same phone number and survey ID exists.booleanFALSE
phone_number
  • The phone number to be used for the survey
  • Required for voice and sms interactions
A 12-character string in the proper phone-number formatempty
phone_connection_id
  • The ID of the phone connection you wish the interaction to use
  • Valid for voice/sms interactions
integerempty
email
  • The email address of the survey respondent
  • Required for email interactions
An email addressempty
survey_typeThe survey medium to useinbound, outbound, sms, web, email, websmsweb
scheduled_atThe 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.
  • dateTime string
  • Accepts times in standard UTC format and in the format Now + X Days/Hours/Minutes
now
external_refA standard string field for referencing external system IDsstringempty
call_typeA standard string field for report aggregationstringempty
agent_id
  • A string corresponding to an agent ID
  • Will allow an agent user with this ID to see the interaction in the dashboard, and will be used to aggregate agent rankings
stringempty
respondent_language
  • The language of the survey respondent
  • This is used to select survey prompts in multi-language surveys and to determine what language and dialect to use when automatically transcribing voice responses.
see Supported Languagesdetermined by region
_shorten_urlsGenerate a short URL for the Start Survey link and the Unsubscribe link.booleanFALSE
Custom MetadataParameters 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.

example authorization configurationUsing Basic Authorization (credentials found at Customer Settings > Customer Credentials)Example headers configurationOne header added: content-type = application/jsonexample request and response