Skip to main content

post_easy_dispatches

POST /easy_dispatches​

Send a survey to a specified email address

require 'rest-client'

RestClient::Request.execute method: :post,
url: 'https://api.diduenjoy.com/api/v1/easy_dispatches',
user: 'PUT-YOUR-API-KEY-HERE',
headers: {
content_type: 'application/json'
},
payload: {
email: 'client@example.com', # or phone_number: '+336xxxxxxxx'
survey_id: 'YOUR-SURVEY-ID-HERE',
template_id: 'YOUR-TEMPLATE-ID-HERE',
segments: {
language: 'EN',
scheduled_at: '2022-04-18 15:07:00',
gender: 'Mister',
name: 'Rick Sanchez',
interests: 'Science',
},
dispatch_probability: 0.5
}.to_json

# => {
# "id": "DISPATCH-ID",
# "email": "client@example.com", # or "phone_number": "+336xxxxxxxx"
# "survey_id": "YOUR-SURVEY-ID-HERE",
# "template_id": "YOUR-TEMPLATE-ID-HERE",
# "segments": {
# "language": "EN",
# "scheduled_at": "2022-04-18 15:07:00",
# "gender": "Mister",
# "name": "Rick Sanchez",
# "interests": "Science"
# },
# "dispatch_probability": 0.5
# }
note
segments
  • language and scheduled_at are special segments.
  • gender, name and interests are user defined.

attributes​

attributedescription
email
string
either email or phone number or no_dispatch requiredemail address to which send the survey
phone_number
string
either email or phone number or no_dispatch requiredphone number to which the survey will be send. The international format should be used (ex: +33)
survey_id
string
requiredid of the survey
template_id
string
either template_id or no_dispatch requiredid of the template
segments
hash { string: string }
custom data associated with the survey
dispatch_probability
string
probability for the survey to be sent
no_dispatch
boolean
set it to disable sending of the survey and only create an new feedback that you could dispatch by your own means

Segments​

All segments are dynamically created, you can name them as you want.

There is 2 exceptions:

Remarks​

  • The dispatch mode is specified by which of the parameters email or phone_number is set. One and only one of them should be specified