Here’s my code:
app.post('/api/outgoing-from-ac', async (req, res, next) => {
try {
const {contact} = req.body;
const {email, first_name, last_name, phone, tags} = contact;
let response = await axios({
method: 'post',
url: 'https://app2.simpletexting.com/v1/group/contact/add',
json: true,
data: querystring.stringify({
token: config.simple_texting.token,
group: 'Registrants',
phone,
firstName: first_name,
lastName: last_name,
email,
custom_tags: tags, // <--- This does not work!
}),
headers: {
'content-type': 'application/x-www-form-urlencoded',
},
});
console.log(response.data);
res.json({
status: 'OK',
});
} catch (error) {
console.log(error);
res.json({
success: false,
message: 'Error!',
});
}
});
So I’m trying to add contacts to a list in SimpleTexting using their API, along with tags with the other data, I removed all the unnecessary codes since everything else is working just fine.
When I try to add a contact without custom_tags
, it adds, but when I use the custom_tags
, it gives out the error { code: -611, message: 'Unknown custom field' }
This is what their documentation reads:
customField
string
Any custom field of a contact, where customField` must be replaced with the actual custom field’s parameter.
For example, if you have a ‘Street address’ custom field, you would use the parameter ‘street_address’.
I tested customField
, I tested object inside customField
, I tested custom_tags
, I tested tags
, nothing is working. What is the issue here? How should it be coded?