How to generate text
This article explains how to start generating personalized sentences for your contacts.
In order to generate text using the API today you will need two pieces of information:
The sentence premise ID
A dictionary of variables that contain contact data if you are generating a sentence or the inputs if you are generating an email.
The example below will illustrate the process for generating a sentence premise however the process is the same for email generation.
Premises can only be created in your dashboard.
Let's start by grabbing our sentence ID.
You can filter for sentence premise IDs by using the 'list all premises' or 'get premise' endpoints'. This is what the object returned will look like.
The 'required variables' key contains an array of fields that need data for this sentence premise to generate.
In the example above we would therefore need to create a dictionary with the keys 'person_description' and 'first_name' where the values are the contact data inputs.
Once we have these two pieces of information the last step is to make a POST request to the generate sentence endpoint.
An example in python could look like this:
If you get an error try looking at the meta data to see the related objects.
And you are done!
Consult the text generation object by going to the link below.
Generate textLast updated