Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] Add functionality to process callbacks. #41

Merged
merged 3 commits into from
Dec 1, 2020

Conversation

mikebronner
Copy link
Contributor

@mikebronner mikebronner commented Nov 30, 2020

This allows handling of contextual callbacks, so that status updates may be associated with a notification that has been sent out.

For example:

    public function toNexmo(Communication $notifiable): NexmoMessage
    {
        return (new NexmoMessage)
            ->statusCallback(url("api/webhooks/nexmo/status/{$notifiable->getKey()}"))
            ->from(config("services.nexmo.sms_from"))
            ->content($notifiable->message);
    }

This will allow for the storage of status updates for the notification, perhaps like so:

        (new NexmoWebhookLog)
            ->create([
                "api_key" => $this->input("api-key"),
                "communication_id" => $this->communication->getKey(), // $this->communication is the $notifiable in the above snippet
                "err_code" => $this->input("err-code"),
                "message_timestamp" => $this->input("message-timestamp"),
                "messageId" => $this->messageId,
                "msisdn" => $this->msisdn,
                "network_code" => $this->input("network-code"),
                "price" => $this->price,
                "scts" => $this->scts,
                "status" => $this->status,
                "to" => $this->to,
            ]);

@driesvints driesvints changed the title Add functionality to process callbacks. [2.x] Add functionality to process callbacks. Nov 30, 2020
@taylorotwell taylorotwell merged commit 1dd93f3 into laravel:2.0 Dec 1, 2020
@mikebronner
Copy link
Contributor Author

Thanks for merging this PR, @driesvints @taylorotwell :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants