Closed quentint closed 3 years ago
The first example was close, but it needs to include a time to send at value (UNIX timestamp for the date and time you would like your campaign to be sent out). E.g.,:
$sg->client->campaigns()->_($campaignId)->schedules()->post(['send_at' => 1489771528]);
Or just send now:
$sg->client->campaigns()->_($campaignId)->schedules()->now()->post();
Thanks @childish-sambino,
I've tried your second snippet (I'm trying to send now), but I get a 403 with {"errors":[{"field":null,"message":"access forbidden"}]}
. All my other calls are OK (so I guess the API key, a Full Access one, is good).
The other places in my code where I successfully use the campaigns API is by using $this->sg->client->marketing()->campaigns()->post($request)
(note the extra ->marketing()
).
Of course I tried $this->sg->client->marketing()->campaigns()->_($campaignId)->schedules()->now()->post();
bot got a 404 🙁
Any idea? Could my API key (or account) be insufficient for sending/scheduling campaigns?
Docs there may help: https://sendgrid.api-docs.io/v3.0/single-sends
Example:
$response = $sg->client->marketing()->singlesends()->_($campaignId)->schedule()->put(['send_at' => 'now']);
Wow, it works! Thanks very much!
I have two questions:
schedule()
in its @method
PHPDOC comments, so I never knew it existed. Is that something that requires a PR?
Issue Summary
Sending a campaign using the "sendgrid/sendgrid ^7.8" PHP API.
Steps to Reproduce
I tried lots of variations of API calls, including:
$sg->client->campaigns()->_($campaignId)->schedules()->post();
$sg->client->marketing()->campaigns()->_($campaignId)->schedules()->now()->post();
But none of them worked.
Technical details:
Also: I noticed I can't use your docs because everything seems off (different method chaining, different parameters). Where can I find the proper docs (for ^7.8)?
Thanks in advance.
Note: I opened a support request on support.sendgrid.com (#5288817) but got no answer 🙁