Erik Posted January 26, 2017 Share Posted January 26, 2017 This is probably very simple. I've tried looking and can't seem to figure it out. I'd like to create a new email template and deploy it *specific to a customer* from our API. So that the customer name variable (and others) can be used. So I could send the email id and customer id via the API code and it just sends that email with that customers variables filling in all the blanks. 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted January 26, 2017 Share Posted January 26, 2017 Are you just looking to send an email to one customer, or a number of them? It looks like the sendemail API can handle what you're after (kind of), but it can't be singled out for just one customer. Not sure WHY this was done this way, honestly, but it is what it is. Alternatively, you can grab the information you're after from the DB, put it in your message that way. No, it's not templated, and it's a pretty ugly hack to doing this, but it may be the only way, for now. to do this. 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted January 26, 2017 Share Posted January 26, 2017 https://developers.whmcs.com/api-reference/sendemail/ Set "customtype" to the type of email template that you created. Set "messagename" to the email template name. Set the "id" to the customer id or if it is a service template set it to the service id. Then in the template just use the usual variables as shown on the template page. That would work for any customer you feed in. If you really need it for just "specific customer" ( one customer ), you could just do the same and name it special for that customer. Or use the template if/else statements to customize it for the specific customer: {if $client_id eq 11111 }Hey Joe, this is your specific message{/if} 0 Quote Link to comment Share on other sites More sharing options...
Erik Posted January 28, 2017 Author Share Posted January 28, 2017 I'm looking at sending an email to a single customer using a custom email template, which uses our HTML format. I wouldn't want to recreate that in a hard coded email in php. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 28, 2017 Share Posted January 28, 2017 Erik, This is probably very simple. I've tried looking and can't seem to figure it out.I'd like to create a new email template and deploy it *specific to a customer* from our API. So that the customer name variable (and others) can be used. So I could send the email id and customer id via the API code and it just sends that email with that customers variables filling in all the blanks. perhaps i'm missing the point, but is there any need for an API solution for this? e.g., couldn't you just use the Mass Mail feature of WHMCS, put this one client into their own client group, and then compose (and save if you intend to re-use it) the message - you'd have access to the client merge fields, so you could use their name etc in the content of the emails. 0 Quote Link to comment Share on other sites More sharing options...
Erik Posted January 28, 2017 Author Share Posted January 28, 2017 perhaps i'm missing the point, but is there any need for an API solution for this? e.g., couldn't you just use the Mass Mail feature of WHMCS, put this one client into their own client group, and then compose (and save if you intend to re-use it) the message - you'd have access to the client merge fields, so you could use their name etc in the content of the emails. Not surprised. I asked for a way to do this via API and then someone questions it and instead gives me a way to do it through WHMCS? We use a call center and it's far easier for them to use our custom app with a few WHMCS API access points so that they are not toggling back and forth. It works great, but we need this one feature. I didn't explain this before because I didn't think it was relevant or necessary, but yes.. we need an API solution. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 28, 2017 Share Posted January 28, 2017 Not surprised. I asked for a way to do this via API and then someone questions it and instead gives me a way to do it through WHMCS? you wouldn't necessarily be the first person on here to ask for a solution using one method, when there is a way to do it using another that they perhaps hadn't thought of... however, i'll leave you to solve your API solution yourself. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.