#MSG 91 ERROR

40 messages · Page 1 of 1 (latest)

remote cloud
#

hi,
I have set up the sms properly but the messages are not being received from msg 91 and inspecting the logs i got to know the mobile number and message is not being delivered by Appwrtite.

#

i also tried this from the other thread

docker compose restart appwrite-worker-messaging```
#

but its still the same

#

this should be the body according to the docs https://docs.msg91.com/reference/send-sms

{ 
"template_id":"EntertemplateID",  "short_url": "1 (On) or 0 (Off)",     "recipients" : [     
  {
  "mobiles":"919XXXXXXXXX",       
  "VAR1": "VALUE1",       
  "VAR2": "VALUE2"         
  }   
] 
}
MSG91
ocean notch
remote cloud
remote cloud
# ocean notch What was the output of this?

its just docker compose exec appwrite-worker-messaging sed -i 's#\[$to\]#$to#g' /usr/src/code/vendor/utopia-php/messaging/src/Utopia/Messaging/Adapters/SMS/Msg91.php docker compose restart appwrite-worker-messaging WARN[0000] The "Usssf" variable is not set. Defaulting to a blank string. WARN[0000] The "Usssf" variable is not set. Defaulting to a blank string. WARN[0000] The "Usssf" variable is not set. Defaulting to a blank string. WARN[0000] The "Usssf" variable is not set. Defaulting to a blank string. WARN[0000] The "Usssf" variable is not set. Defaulting to a blank string. WARN[0000] The "Usssf" variable is not set. Defaulting to a blank string. WARN[0000] The "Usssf" variable is not set. Defaulting to a blank string. [+] Restarting 1/1 ✔ Container appwrite-worker-messaging Started 10.4s

ocean notch
remote cloud
#

What do i have to do it with the Msg91.php file?

ocean notch
remote cloud
# ocean notch Share the code in the process function

its

protected function process(SMS $message): string
    {
        $to = \array_map(
            fn ($to) => ['mobiles' => \ltrim($to, '+')],
            $message->getTo()
        );

        return $this->request(
            method: 'POST',
            url: 'https://api.msg91.com/api/v5/flow/',
            headers: [
                'content-type: application/json',
                "authkey: {$this->authKey}",
            ],
            body: \json_encode([
                'sender' => $this->senderId,
                'otp' => $message->getContent(),
                'flow_id' => $message->getFrom(),
                'recipients' => $to,
            ]),
        );
    }
ocean notch
remote cloud
#

its getting the auth key proper.. and also flow id

#

but only the messge and mobile is missing

ocean notch
remote cloud
ocean notch
remote cloud
ocean notch
remote cloud
#

But the Usssf never gave me any trouble

remote cloud
#

and in docker compose file there are no occurances

ocean notch
#

Ya...dollar signs would get interpolated improperly

remote cloud
#

just remove the $ sign ?

#

yes you are right

ocean notch
remote cloud
ocean notch
remote cloud
# ocean notch Then run this again

this time it ran without any errors

docker compose exec appwrite-worker-messaging sed -i 's#\[$to\]#$to#g' /usr/src/code/vendor/utopia-php/messaging/src/Utopia/Messaging/Adapters/SMS/Msg91.php
docker compose restart appwrite-worker-messaging
[+] Restarting 1/1
 ✔ Container appwrite-worker-messaging  Started                           10.5s
remote cloud
#

i got the sms

ocean notch
#

I don't really understand why the incorrect openssl key would make the sms not send