One of the most common pitfalls when integrating an [SMS API in Morocco](/fr/api-sms-maroc/) is unexpected overcharging related to encoding. You send a campaign of 10,000 messages in Darija, and your provider charges you 30,000 credits. For what ? Because SMS is not billed "per message", but "per segment".
If you are building an in-house CRM or a business application, you must definitely show your users the number of segments they are about to consume before they click “Send”.
Here is the technical specification (GSM 03.38) and code to implement a robust segment counter in your applications.


