The social media company agreed to open a local office and meet other conditions in order for Nigeria to lift its ban.
The reversal came seven months after the telecoms providers in the country were ordered to block the social networking site because of a post by the president. The ban will be lifted on Thursday.
The code of conduct will be developed in line with global best practices, and will acknowledge the Nigerian laws and the national culture and history of the country.
The company agreed to pay domestic taxes and appoint a country head.
In June, the government said it had banned the platform because it was being used for activities that could undermine Nigeria's corporate existence.
Since he was elected in 2015, the local activists have accused the former military dictator of closing the civic space in Nigeria.
The Special Anti-Robbery Squad, a notorious police unit, was referred to as the #EndSARS by protesters who took to the streets in protest.
Jack Dorsey, the chief executive of the social media company, posted his support for the demonstrations using the #, which went viral.
It is popular among activists, journalists and politicians in Nigeria, but it is used by a small percentage of people.
The EU, UK, Ireland, Norway and Canada are all diplomats. The US embassy in Nigeria said that it undermines the ability to exercise freedom of expression and that it sends a poor message to its citizens, investors and businesses.
The ban on using virtual private networks in Nigeria has been circumvented by opposition politicians. The platform has also been used by members of the government.