Skip to content

Instantly share code, notes, and snippets.

@carlosfilho88
Last active April 7, 2021 12:49
Show Gist options
  • Save carlosfilho88/b9d936e7ac4301c093dd634ede7db9f1 to your computer and use it in GitHub Desktop.
Save carlosfilho88/b9d936e7ac4301c093dd634ede7db9f1 to your computer and use it in GitHub Desktop.
Enviar múltiplos sms pela Zenvia | Guzzle PHP
$lista_sms = [];
foreach($algo as $a) {
$sms = [
"id"=>id_unico_na_zenvia,
"from"=>nome_empresa,
"to"=>numero_com_ddi_ddd,
"msg"=>msg,
"schedule"=>se_quiser_agendar,
"callbackOption"=>"FINAL",
];
array_push($lista_sms,$sms);
}
}
$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api-rest.zenvia360.com.br/services/send-sms-multiple',
[
'headers' => [
'Authorization' => 'Basic base64(user+senha)',
'Content-Type' => 'application/json',
'Accept' => 'application/json'
],
'json' => [
"sendSmsMultiRequest"=>
[
"aggregateId" => id_lote_no_banco,
"sendSmsRequestList" => $lista_sms
]
]
]
);
@odirleiborgert
Copy link

Olá Carlos,

Você costuma enviar lotes de quantos SMS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment