PHP | How to extract all email/SMS templates for the companies of an account

Publié sur un an il y a par  Julien Pauthier

Publier un sujet
Julien Pauthier
Julien Pauthier Administrateur

You can extract all templates from the locations of an account:


<?php 
$token = "";
$apikey = "";

// Fetching list of companies/locations for the account
$results = json_decode(file_get_contents("https://app.agendize.com/api/2.1/scheduling/companies?apiKey=$apikey&token=$token"));

foreach ($results->items as $company) {
    // Fetching list of email templates for the current company/location
    $ct = json_decode(file_get_contents("https://app.agendize.com/api/2.1/scheduling/companies/$company->id/settings/messages/emails?apiKey=$apikey&token=$token"));
    foreach ($ct->items as $key => $email) {
        file_put_contents("email_" . $company->id . "_" . $email->language . "_" . $email->name . "_" . $email->id . ".html", $email->html);
    }
    
    $ct = json_decode(file_get_contents("https://app.agendize.com/api/2.1/scheduling/companies/$company->id/settings/messages/sms?apiKey=$apikey&token=$token"));
    foreach ($ct->items as $key => $sms) {
        file_put_contents("sms_" . $company->id . "_" . $sms->language . "_" . $sms->name . "_" . $sms->id . ".txt", $sms->text);
    }
}
?>


0 Votes


0 Commentaires

Connexion ou S'inscrire pour poster un commentaire